add composer

This commit is contained in:
xiaomlove
2021-01-13 19:32:26 +08:00
parent 1eb5d8441e
commit 0541f2a6c0
665 changed files with 889 additions and 150 deletions
+31
View File
@@ -0,0 +1,31 @@
Release note for v1.5 beta 5 20120707
fix tracker "can't unzip" issue when zlib is not enabled
Release note for v1.5 beta 5 20120301
Fix: several security issues
Fix: takesignup not checking invitation code
Fix: function sqlesc() with numeric value
Fix: sendmail delay issue
Fix: language file in docleanup()
Fix: language setting at FAQ and Rules
Mod: default promotion display type to 'icon'
thank http://wiki.nexusphp.org for reporting bugs
Release note for v1.5 beta 4 20100919
Fix: "There is a minimum announce time of 30 seconds", caused by timezone settings. Now you should set correct timezone in php.ini
Fix: varchar column length exceed 255 characters, which causes errors in MySQL 5.0.3 and later
Mod: set mysql sql_mode in php level
Mod: change mysql_pconnect to mysql_connect
Release note for v1.5 beta 4 20100905
Add: promotion timeout setting per torrent
Fix: some minor bugs
Release note for v1.5 beta 4 20100615
Change default cleanup from cron-triggered to browser-triggered
Release note for v1.5 beta 4 20100603
Fix a few minor bugs from previous release
Release note for v1.5 beta 4 20100531
Fix a few minor bugs from previous release
Release note for v1.5 beta 4 20100517
This release is not considered stable and ready for major time. A lot of things, especially those in staff panel, may not work as expected.
No installer available yet.
Use it at your own risk.
+65
View File
@@ -0,0 +1,65 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
stdhead(PROJECTNAME);
print ("<h1>".PROJECTNAME."</h1>");
begin_main_frame();
begin_frame("<span id=\"version\">".$lang_aboutnexus['text_version']."</span>");
print ($lang_aboutnexus['text_version_note']);
print ("<br /><br /><table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\">");
tr($lang_aboutnexus['text_main_version'],$mainversion_code,1);
tr($lang_aboutnexus['text_sub_version'],$subversion_code,1);
tr($lang_aboutnexus['text_release_date'],$releasedate_code,1);
print ("</table>");
print ("<br /><br />");
end_frame();
begin_frame("<span id=\"nexus\">".$lang_aboutnexus['text_nexus'].PROJECTNAME."</span>");
print (PROJECTNAME.$lang_aboutnexus['text_nexus_note']);
print ("<br /><br />");
end_frame();
begin_frame("<span id=\"authorization\">".$lang_aboutnexus['text_authorization']."</span>");
print ($lang_aboutnexus['text_authorization_note']);
print ("<br /><br />");
end_frame();
$ppl = '';
$res = sql_query("SELECT * FROM language ORDER BY trans_state") or sqlerr();
while ($arr = mysql_fetch_assoc($res))
{
$ppl .= "<tr><td class=\"rowfollow\"><img width=\"24\" height=\"15\" src=\"pic/flag/".$arr['flagpic']."\" alt=\"".$arr['lang_name']."\" title=\"".$arr['lang_name']."\" style=\"padding-bottom:1px;\" /></td>
<td class=\"rowfollow\">".$arr['lang_name']."</td>".
"<td class=\"rowfollow\">".$arr['trans_state']."</td></tr>\n";
}
begin_frame("<span id=\"translation\">".$lang_aboutnexus['text_translation']."</span>");
print (PROJECTNAME.$lang_aboutnexus['text_translation_note']);
print ("<br /><br /><table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\"><tr><td class=\"colhead\">".$lang_aboutnexus['text_flag']."</td><td class=\"colhead\">".$lang_aboutnexus['text_language']."</td><td class=\"colhead\">".$lang_aboutnexus['text_state']."</td></tr>");
print ($ppl);
print ("</table>");
print ("<br /><br />");
end_frame();
$ppl = '';
$res = sql_query("SELECT * FROM stylesheets ORDER BY id") or sqlerr();
while ($arr = mysql_fetch_assoc($res))
{
$ppl .= "<tr><td class=\"rowfollow\">".$arr['name']."</td>
<td class=\"rowfollow\">".$arr['designer']."</td>".
"<td class=\"rowfollow\">".$arr['comment']."</td></tr>\n";
}
begin_frame("<span id=\"stylesheet\">".$lang_aboutnexus['text_stylesheet']."</span>");
print ($lang_aboutnexus['text_stylesheet_note']);
print ("<br /><br /><table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\"><tr><td class=\"colhead\">".$lang_aboutnexus['text_name']."</td><td class=\"colhead\">".$lang_aboutnexus['text_designer']."</td><td class=\"colhead\">".$lang_aboutnexus['text_comment']."</td></tr>");
print ($ppl);
print ("</table>");
print ("<br /><br />");
end_frame();
begin_frame("<span id=\"contact\">".$lang_aboutnexus['text_contact'].PROJECTNAME."</span>");
print ($lang_aboutnexus['text_contact_note']);
print ("<br /><br /><table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\">");
tr($lang_aboutnexus['text_web_site'],$website_code ? $website_code : "N/A",1);
print ("</table>");
print ("<br /><br />");
end_frame();
end_main_frame();
stdfoot();
?>
+58
View File
@@ -0,0 +1,58 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_ADMINISTRATOR)
stderr("Error", "Access denied.");
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if ($_POST["username"] == "" || $_POST["password"] == "" || $_POST["email"] == "")
stderr("Error", "Missing form data.");
if ($_POST["password"] != $_POST["password2"])
stderr("Error", "Passwords mismatch.");
$email = htmlspecialchars(trim($_POST["email"]));
$email = safe_email($email);
if (!check_email($email))
stderr("Error","Invalid email address!");
$username = $_POST["username"];
if (!validusername($username))
stderr("Error","Invalid username.");
$username = sqlesc($username);
$res = sql_query("SELECT id FROM users WHERE username=$username");
$arr = mysql_fetch_row($res);
if ($arr)
stderr("Error","Username already exists!");
$password = $_POST["password"];
$email = sqlesc($_POST["email"]);
$res = sql_query("SELECT id FROM users WHERE email=$email");
$arr = mysql_fetch_row($res);
if ($arr)
stderr("Error","The e-mail address is already in use.");
$secret = mksecret();
$passhash = sqlesc(md5($secret . $password . $secret));
$secret = sqlesc($secret);
sql_query("INSERT INTO users (added, last_access, secret, username, passhash, status, stylesheet, class,email) VALUES(NOW(), NOW(), $secret, $username, $passhash, 'confirmed', ".$defcss.",".$defaultclass_class.",$email)") or sqlerr(__FILE__, __LINE__);
$res = sql_query("SELECT id FROM users WHERE username=$username");
$arr = mysql_fetch_row($res);
if (!$arr)
stderr("Error", "Unable to create the account. The user name is possibly already taken.");
header("Location: " . get_protocol_prefix() . "$BASEURL/userdetails.php?id=".htmlspecialchars($arr[0]));
die;
}
stdhead("Add user");
?>
<h1>Add user</h1>
<form method=post action=adduser.php>
<table border=1 cellspacing=0 cellpadding=5>
<tr><td class=rowhead>User name</td><td><input type=text name=username size=40></td></tr>
<tr><td class=rowhead>Password</td><td><input type=password name=password size=40></td></tr>
<tr><td class=rowhead>Re-type password</td><td><input type=password name=password2 size=40></td></tr>
<tr><td class=rowhead>E-mail</td><td><input type=text name=email size=40></td></tr>
<tr><td colspan=2 align=center><input type=submit value="Okay" class=btn></td></tr>
</table>
</form>
<?php stdfoot();
+427
View File
@@ -0,0 +1,427 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
if (get_user_class() < UC_MODERATOR)
permissiondenied();
$allowxhtmlclass = UC_ADMINISTRATOR;
function get_position_name($position)
{
global $lang_admanage;
switch ($position)
{
case 'header':
$name = $lang_admanage['text_header'];
break;
case 'footer':
$name = $lang_admanage['text_footer'];
break;
case 'belownav':
$name = $lang_admanage['text_below_navigation'];
break;
case 'belowsearchbox':
$name = $lang_admanage['text_below_searchbox'];
break;
case 'torrentdetail':
$name = $lang_admanage['text_torrent_detail'];
break;
case 'comment':
$name = $lang_admanage['text_comment_page'];
break;
case 'interoverforums':
$name = $lang_admanage['text_inter_overforums'];
break;
case 'forumpost':
$name = $lang_admanage['text_forum_post_page'];
break;
case 'popup':
$name = $lang_admanage['text_popup'];
break;
}
return $name;
}
function get_type_name($type)
{
global $lang_admanage;
switch ($type)
{
case 'bbcodes':
$name = $lang_admanage['text_bbcodes'];
break;
case 'xhtml':
$name = $lang_admanage['text_xhtml'];
break;
case 'text':
$name = $lang_admanage['text_text'];
break;
case 'image':
$name = $lang_admanage['text_image'];
break;
case 'flash':
$name = $lang_admanage['text_flash'];
break;
}
return $name;
}
function print_ad_editor($position, $row = "")
{
global $lang_admanage;
global $allowxhtmlclass;
switch ($position)
{
case 'header':
$note = $lang_admanage['text_header_note'];
break;
case 'footer':
$note = $lang_admanage['text_footer_note'];
break;
case 'belownav':
$note = $lang_admanage['text_below_navigation_note'];
break;
case 'belowsearchbox':
$note = $lang_admanage['text_below_searchbox_note'];
break;
case 'torrentdetail':
$note = $lang_admanage['text_torrent_detail_note'];
break;
case 'comment':
$note = $lang_admanage['text_comment_page_note'];
break;
case 'interoverforums':
$note = $lang_admanage['text_inter_overforums_note'];
break;
case 'forumpost':
$note = $lang_admanage['text_forum_post_page_note'];
break;
case 'popup':
$note = $lang_admanage['text_popup_note'];
break;
}
if ($row)
{
$pararow = @unserialize($row['parameters']);
$name = $row['name'];
$starttime = $row['starttime'];
$endtime = $row['endtime'];
$displayorder = $row['displayorder'];
$enabled = $row['enabled'];
$type = $row['type'];
}
else
{
$name = "";
$starttime = "";
$endtime = "";
$displayorder = 0;
$enabled = 1;
$type = 'image';
}
?>
<div style="width: 940px">
<h1 align="center"><a class="faqlink" href="admanage.php"><?php echo $lang_admanage['text_ad']?></a> - <?php echo get_position_name($position)?></h1>
<div><p align="center"><?php echo $note?></p></div>
<h2 align="left"><?php echo $lang_admanage['text_ad_detail']?></h2>
<table border="1" cellspacing="0" cellpadding="10" width="100%">
<?php
tr($lang_admanage['row_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[name]\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_admanage['text_name_note'], 1);
tr($lang_admanage['row_start_time'], "<input type=\"text\" name=\"ad[starttime]\" value=\"".$starttime."\" style=\"width: 300px\" /> " . $lang_admanage['text_start_time_note'], 1);
tr($lang_admanage['row_end_time'], "<input type=\"text\" name=\"ad[endtime]\" value=\"".$endtime."\" style=\"width: 300px\" /> ".$lang_admanage['text_end_time_note'], 1);
tr($lang_admanage['row_order'], "<input type=\"text\" name=\"ad[displayorder]\" value=\"".$displayorder."\" style=\"width: 100px\" /> ".$lang_admanage['text_order_note'], 1);
tr($lang_admanage['row_enabled']."<font color=\"red\">*</font>", "<input type=\"radio\" name=\"ad[enabled]\"".($enabled ? " checked=\"checked\"" : "")." value=\"1\" />".$lang_admanage['text_yes']."<input type=\"radio\" name=\"ad[enabled]\"".($enabled ? "" : " checked=\"checked\"")." value=\"0\" />".$lang_admanage['text_no']."<br />".$lang_admanage['text_enabled_note'], 1);
tr($lang_admanage['row_type']."<font color=\"red\">*</font>", "<select name=\"ad[type]\" onchange=\"var key, types; types=new Array('image','text','bbcodes','xhtml','flash'); for(key in types){var obj=$('type_'+types[key]); obj.style.display=types[key]==this.options[this.selectedIndex].value?'':'none';}\"><option value=\"image\"".($type == 'image' ? " selected=\"selected\"" : "").">".$lang_admanage['text_image']."</option><option value=\"text\"".($type == 'text' ? " selected=\"selected\"" : "").">".$lang_admanage['text_text']."</option><option value=\"bbcodes\"".($type == 'bbcodes' ? " selected=\"selected\"" : "").">".$lang_admanage['text_bbcodes']."</option>".(get_user_class() >= $allowxhtmlclass ? "<option value=\"xhtml\"".($type == 'xhtml' ? " selected=\"selected\"" : "").">".$lang_admanage['text_xhtml']."</option>" : "")."<option value=\"flash\"".($type == 'flash' ? " selected=\"selected\"" : "").">".$lang_admanage['text_flash']."</option></select> ".$lang_admanage['text_type_note'], 1);
?>
</table>
<div id="type_image"<?php echo $type == 'image' ? "" : " style=\"display: none;\""?>>
<h2 align="left"><?php echo $lang_admanage['text_image']?></h2>
<table border="1" cellspacing="0" cellpadding="10" width="100%">
<?php
tr($lang_admanage['row_image_url']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[image][url]\"".($type == 'image' ? " value=\"".($pararow['url'] ?? '')."\"" : "")." style=\"width: 300px\" /> ".$lang_admanage['text_image_url_note'], 1);
tr($lang_admanage['row_image_link']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[image][link]\"".($type == 'image' ? " value=\"".($pararow['link'] ?? '')."\"" : "")." style=\"width: 300px\" /> ".$lang_admanage['text_image_link_note'], 1);
tr($lang_admanage['row_image_width'], "<input type=\"text\" name=\"ad[image][width]\"".($type == 'image' ? " value=\"".($pararow['width'] ?? '')."\"" : "")." style=\"width: 100px\" /> ".$lang_admanage['text_image_width_note'], 1);
tr($lang_admanage['row_image_height'], "<input type=\"text\" name=\"ad[image][height]\"".($type == 'image' ? " value=\"".($pararow['height'] ?? '')."\"" : "")." style=\"width: 100px\" /> ".$lang_admanage['text_image_height_note'], 1);
tr($lang_admanage['row_image_tooltip'], "<input type=\"text\" name=\"ad[image][title]\"".($type == 'image' ? " value=\"".($pararow['title'] ?? '')."\"" : "")." style=\"width: 300px\" /> ".$lang_admanage['text_image_tooltip_note'], 1);
?>
</table>
</div>
<div id="type_text"<?php echo $type == 'text' ? "" : " style=\"display: none;\""?>>
<h2 align="left"><?php echo $lang_admanage['text_text']?></h2>
<table border="1" cellspacing="0" cellpadding="10" width="100%">
<?php
tr($lang_admanage['row_text_content']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[text][content]\"".($type == 'text' ? " value=\"".$pararow['content']."\"" : "")." style=\"width: 300px\" /> ".$lang_admanage['text_text_content_note'], 1);
tr($lang_admanage['row_text_link']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[text][link]\"".($type == 'text' ? " value=\"".$pararow['link']."\"" : "")." style=\"width: 300px\" /> ".$lang_admanage['text_text_link_note'], 1);
tr($lang_admanage['row_text_size'], "<input type=\"text\" name=\"ad[text][size]\"".($type == 'text' ? " value=\"".$pararow['size']."\"" : "")." style=\"width: 100px\" /> ".$lang_admanage['text_text_size_note'], 1);
?>
</table>
</div>
<div id="type_bbcodes"<?php echo $type == 'bbcodes' ? "" : " style=\"display: none;\""?>>
<h2 align="left"><?php echo $lang_admanage['text_bbcodes']?></h2>
<table border="1" cellspacing="0" cellpadding="10" width="100%">
<?php
tr($lang_admanage['row_bbcodes_code']."<font color=\"red\">*</font>", "<textarea name=\"ad[bbcodes][code]\" cols=\"50\" rows=\"6\" style=\"width: 300px\">".($type == 'bbcodes' ? $pararow['code'] : "")."</textarea><br />".$lang_admanage['text_bbcodes_code_note']."<a class=\"altlink\" href=\"tags.php\"><b>".$lang_admanage['text_here']."</b></a>", 1);
?>
</table>
</div>
<div id="type_xhtml"<?php echo $type == 'xhtml' ? "" : " style=\"display: none;\""?>>
<h2 align="left"><?php echo $lang_admanage['text_xhtml']?></h2>
<table border="1" cellspacing="0" cellpadding="10" width="100%">
<?php
tr($lang_admanage['row_xhtml_code']."<font color=\"red\">*</font>", "<textarea name=\"ad[xhtml][code]\" cols=\"50\" rows=\"6\" style=\"width: 300px\">".($type == 'xhtml' ? $pararow['code'] : "")."</textarea><br />".$lang_admanage['text_xhmtl_code_note'], 1);
?>
</table>
</div>
<div id="type_flash"<?php echo $type == 'flash' ? "" : " style=\"display: none;\""?>>
<h2 align="left"><?php echo $lang_admanage['text_flash']?></h2>
<table border="1" cellspacing="0" cellpadding="10" width="100%">
<?php
tr($lang_admanage['row_flash_url']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[flash][url]\"".($type == 'flash' ? " value=\"".$pararow['url']."\"" : "")." style=\"width: 300px\" /> ".$lang_admanage['text_flash_url_note'], 1);
tr($lang_admanage['row_flash_width']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[flash][width]\"".($type == 'flash' ? " value=\"".$pararow['width']."\"" : "")." style=\"width: 100px\" /> ".$lang_admanage['text_flash_width_note'], 1);
tr($lang_admanage['row_flash_height']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"ad[flash][height]\"".($type == 'flash' ? " value=\"".$pararow['height']."\"" : "")." style=\"width: 100px\" /> ".$lang_admanage['text_flash_height_note'], 1);
?>
</table>
</div>
<div style="text-align: center; margin-top: 10px;">
<input type="submit" value="<?php echo $lang_admanage['submit_submit']?>" />
</div>
</div>
<?php
}
$action = $_GET['action'] ?? '';
if ($action == 'del')
{
$id = intval($_GET['id'] ?? 0);
if (!$id)
{
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_id']);
}
$res = sql_query ("SELECT * FROM advertisements WHERE id = ".sqlesc($id)." LIMIT 1");
if ($row = mysql_fetch_array($res))
sql_query("DELETE FROM advertisements WHERE id = ".sqlesc($row['id'])) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('current_ad_array', false);
header("Location: ".get_protocol_prefix() . $BASEURL."/admanage.php");
die();
}
elseif ($action == 'edit')
{
$id = intval($_GET['id'] ?? 0);
if (!$id)
{
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_id']);
}
else
{
$res = sql_query("SELECT * FROM advertisements WHERE id = ".sqlesc($id)." LIMIT 1");
if (!$row = mysql_fetch_array($res))
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_id']);
else
{
$position = $row['position'];
stdhead($lang_admanage['head_edit_ad']);
print("<form method=\"post\" action=\"?action=submit&amp;position=".$position."\">");
print("<input type=\"hidden\" name=\"isedit\" value=\"1\" />");
print("<input type=\"hidden\" name=\"id\" value=\"".$id."\" />");
print_ad_editor($position, $row);
print("</form>");
stdfoot();
}
}
}
elseif ($action == 'add')
{
$position = $_GET['position'];
$validpos = array('header', 'footer', 'belownav', 'belowsearchbox', 'torrentdetail', 'comment', 'interoverforums', 'forumpost', 'popup');
if (!in_array($position, $validpos))
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_position']);
else
{
stdhead($lang_admanage['head_add_ad']);
print("<form method=\"post\" action=\"?action=submit&amp;position=".htmlspecialchars($position)."\">");
print("<input type=\"hidden\" name=\"isedit\" value=\"0\" />");
print_ad_editor($position);
print("</form>");
stdfoot();
}
}
elseif ($action == 'submit')
{
$position = $_GET['position'];
$validpos = array('header', 'footer', 'belownav', 'belowsearchbox', 'torrentdetail', 'comment', 'interoverforums', 'forumpost', 'popup');
if (!in_array($position, $validpos))
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_position']);
else
{
if ($_POST['isedit']){
$id = intval($_POST['id'] ?? 0);
if (!$id)
{
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_id']);
}
else
{
$adid = $id;
$res = sql_query("SELECT * FROM advertisements WHERE id = ".sqlesc($id)." LIMIT 1");
if (!$row = mysql_fetch_array($res))
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_id']);
}
}
else
{
$res = sql_query("SELECT id FROM advertisements ORDER BY id DESC LIMIT 1");
$row = mysql_fetch_array($res);
if (!$row)
$adid = 1;
else $adid = $row['id']+1;
}
$name = $_POST['ad']['name'];
$starttime = $_POST['ad']['starttime'];
$endtime = $_POST['ad']['endtime'];
$displayorder = intval($_POST['ad']['displayorder'] ?? 0);
$enabled = intval($_POST['ad']['enabled'] ?? 0);
$type = $_POST['ad']['type'];
if (!$name || !$type)
{
stderr($lang_admanage['std_error'], $lang_admanage['std_missing_form_data']);
}
if (get_user_class() >= $allowxhtmlclass)
$validtype = array('bbcodes', 'xhtml', 'text', 'image', 'flash');
else
$validtype = array('bbcodes', 'text', 'image', 'flash');
if (!in_array($type, $validtype))
stderr($lang_admanage['std_error'], $lang_admanage['std_invalid_type']);
switch ($type)
{
case 'bbcodes':
if (!$_POST['ad']['bbcodes']['code'])
stderr($lang_admanage['std_error'], $lang_admanage['std_missing_form_data']);
$parameters = serialize($_POST['ad']['bbcodes']);
$code = format_comment($_POST['ad']['bbcodes']['code'], true, false, true, true, 700, true, true, -1, 0, $adid);
break;
case 'xhtml':
if (!$_POST['ad']['xhtml']['code'])
stderr($lang_admanage['std_error'], $lang_admanage['std_missing_form_data']);
$parameters = serialize($_POST['ad']['xhtml']);
$code = $_POST['ad']['xhtml']['code'];
break;
case 'text':
if (!$_POST['ad']['text']['content'] || !$_POST['ad']['text']['link'])
stderr($lang_admanage['std_error'], $lang_admanage['std_missing_form_data']);
$parameters = serialize($_POST['ad']['text']);
$content = htmlspecialchars($_POST['ad']['text']['content']);
if ($_POST['ad']['text']['size'])
$content = "<span style=\"font-size: ".htmlspecialchars($_POST['ad']['text']['size'])."\">".$content."</span>";
else
$content = "<span style=\"font-size: 30pt\">".$content."</span>";
$code = "<a href=\"adredir.php?id=".$adid."&amp;url=".rawurlencode(htmlspecialchars($_POST['ad']['text']['link']))."\" target=\"_blank\">".$content."</a>";
break;
case 'image':
if (!$_POST['ad']['image']['url'] || !$_POST['ad']['image']['link'])
stderr($lang_admanage['std_error'], $lang_admanage['std_missing_form_data']);
$_POST['ad']['image']['width'] = intval($_POST['ad']['image']['width'] ?? 0);
$_POST['ad']['image']['height'] = intval($_POST['ad']['image']['height'] ?? 0);
$parameters = serialize($_POST['ad']['image']);
$imgadd = "";
if ($_POST['ad']['image']['width'])
$imgadd .= " width=\"".$_POST['ad']['image']['width']."\"";
if ($_POST['ad']['image']['height'])
$imgadd .= " height=\"".$_POST['ad']['image']['height']."\"";
if ($_POST['ad']['image']['title'])
$imgadd .= " title=\"".$_POST['ad']['image']['title']."\"";
$code = "<a href=\"adredir.php?id=".$adid."&amp;url=".rawurlencode(htmlspecialchars($_POST['ad']['image']['link']))."\" target=\"_blank\"><img border=\"0\" src=\"".htmlspecialchars($_POST['ad']['image']['url'])."\"".$imgadd." alt=\"ad\" /></a>";
break;
case 'flash':
$_POST['ad']['flash']['width'] = intval($_POST['ad']['flash']['width'] ?? 0);
$_POST['ad']['flash']['height'] = intval($_POST['ad']['flash']['height'] ?? 0);
if (!$_POST['ad']['flash']['url'] || !$_POST['ad']['flash']['width'] || !$_POST['ad']['flash']['height'])
stderr($lang_admanage['std_error'], $lang_admanage['std_missing_form_data']);
$parameters = serialize($_POST['ad']['flash']);
$code = "<object width=\"".$_POST['ad']['flash']['width']."\" height=\"".$_POST['ad']['flash']['height']."\"><param name=\"movie\" value=\"".htmlspecialchars($_POST['ad']['flash']['url'])."\" /><embed src=\"".htmlspecialchars($_POST['ad']['flash']['url'])."\" width=\"".$_POST['ad']['flash']['width']."\" height=\"".$_POST['ad']['flash']['height']."\" type=\"application/x-shockwave-flash\"></embed></object>";
break;
}
if ($_POST['isedit']){
sql_query("UPDATE advertisements SET enabled=".sqlesc($enabled).", type=".sqlesc($type).", displayorder=".sqlesc($displayorder).", name=".sqlesc($name).", parameters=".sqlesc($parameters).", code=".sqlesc($code).", starttime=".($starttime ? sqlesc($starttime) : "NULL").", endtime=".($endtime ? sqlesc($endtime) : "NULL")." WHERE id=".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('current_ad_array', false);
stderr($lang_admanage['std_success'], $lang_admanage['std_edit_success']."<a href=\"?\"><b>".$lang_admanage['std_go_back']."</b></a>", false);
}
else
{
sql_query("INSERT INTO advertisements (`enabled`, `type`, `position`, `displayorder`, `name`, `parameters`, `code`, `starttime`, `endtime`) VALUES (".sqlesc($enabled).", ".sqlesc($type).", ".sqlesc($position).", ".sqlesc($displayorder).", ".sqlesc($name).", ".sqlesc($parameters).", ".sqlesc($code).", ".($starttime ? sqlesc($starttime) : "NULL").", ".($endtime ? sqlesc($endtime) : "NULL").")") or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('current_ad_array', false);
stderr($lang_admanage['std_success'], $lang_admanage['std_add_success']."<a href=\"?\"><b>".$lang_admanage['std_go_back']."</b></a>", false);
}
}
}
else
{
stdhead($lang_admanage['head_ad_management']);
begin_main_frame();
?>
<h1 align="center"><?php echo $lang_admanage['text_ad_management']?></h1>
<div>
<span id="addad" onclick="dropmenu(this);"><span style="cursor: pointer;" class="big"><b><?php echo $lang_admanage['text_add_ad']?></b></span>
<div id="addadlist" class="dropmenu" style="display: none"><ul>
<li><a href="?action=add&amp;position=header"><?php echo $lang_admanage['text_header']?></a></li>
<li><a href="?action=add&amp;position=footer"><?php echo $lang_admanage['text_footer']?></a></li>
<li><a href="?action=add&amp;position=belownav"><?php echo $lang_admanage['text_below_navigation']?></a></li>
<li><a href="?action=add&amp;position=belowsearchbox"><?php echo $lang_admanage['text_below_searchbox']?></a></li>
<li><a href="?action=add&amp;position=torrentdetail"><?php echo $lang_admanage['text_torrent_detail']?></a></li>
<li><a href="?action=add&amp;position=comment"><?php echo $lang_admanage['text_comment_page']?></a></li>
<li><a href="?action=add&amp;position=interoverforums"><?php echo $lang_admanage['text_inter_overforums']?></a></li>
<li><a href="?action=add&amp;position=forumpost"><?php echo $lang_admanage['text_forum_post_page']?></a></li>
</ul>
</div>
</span>
</div>
<div style="margin-top: 8px">
<?php
$perpage = 20;
$num = get_row_count("advertisements");
if (!$num)
print("<p align=\"center\">".$lang_admanage['text_no_ads_yet']."</p>");
else{
list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?");
$res = sql_query("SELECT * FROM advertisements ORDER BY id DESC ".$limit) or sqlerr(__FILE__, __LINE__);
?>
<table border="1" cellspacing="0" cellpadding="5" width="940">
<tr>
<td class="colhead"><?php echo $lang_admanage['col_enabled']?></td>
<td class="colhead"><?php echo $lang_admanage['col_name']?></td>
<td class="colhead"><?php echo $lang_admanage['col_position']?></td>
<td class="colhead"><?php echo $lang_admanage['col_order']?></td>
<td class="colhead"><?php echo $lang_admanage['col_type']?></td>
<td class="colhead"><?php echo $lang_admanage['col_start_time']?></td>
<td class="colhead"><?php echo $lang_admanage['col_end_time']?></td>
<td class="colhead"><?php echo $lang_admanage['col_clicks']?></td>
<td class="colhead"><?php echo $lang_admanage['col_action']?></td>
</tr>
<?php
while ($row = mysql_fetch_array($res))
{
$clickcount=get_row_count("adclicks", "WHERE adid=".sqlesc($row['id']));
?>
<tr>
<td class="colfollow"><?php echo $row['enabled'] ? "<font color=\"green\">".$lang_admanage['text_yes']."</font>" : "<font color=\"red\">".$lang_admanage['text_no']."</font>" ?></td>
<td class="colfollow"><?php echo htmlspecialchars($row['name'])?></td>
<td class="colfollow"><?php echo get_position_name($row['position'])?></td>
<td class="colfollow"><?php echo $row['displayorder']?></td>
<td class="colfollow"><?php echo get_type_name($row['type'])?></td>
<td class="colfollow"><?php echo $row['starttime'] ? $row['starttime'] : $lang_admanage['text_unlimited']?></td>
<td class="colfollow"><?php echo $row['endtime'] ? $row['endtime'] : $lang_admanage['text_unlimited']?></td>
<td class="colfollow"><?php echo $clickcount?></td>
<td class="colfollow"><a href="javascript:confirm_delete('<?php echo $row['id']?>', '<?php echo $lang_admanage['js_sure_to_delete_ad']?>', '');"><?php echo $lang_admanage['text_delete']?></a> | <a href="?action=edit&amp;id=<?php echo $row['id']?>"><?php echo $lang_admanage['text_edit']?></a></td>
</tr>
<?php
}
?>
</table>
<?php
print($pagerbottom);
}
?>
</div>
<?php
end_main_frame();
stdfoot();
}
?>
+22
View File
@@ -0,0 +1,22 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
if ($enablead_advertisement != 'yes')
stderr($lang_adredir['std_error'], $lang_adredir['std_ad_system_disabled']);
$id=$_GET['id'] ?? 0;
if (!$id)
stderr($lang_adredir['std_error'], $lang_adredir['std_invalid_ad_id']);
$redir=htmlspecialchars_decode(urldecode($_GET['url']));
if (!$redir)
stderr($lang_adredir['std_error'], $lang_adredir['std_no_redirect_url']);
$adcount=get_row_count("advertisements", "WHERE id=".sqlesc($id));
if (!$adcount)
stderr($lang_adredir['std_error'], $lang_adredir['std_invalid_ad_id']);
if ($adclickbonus_advertisement){
$clickcount=get_row_count("adclicks", "WHERE adid=".sqlesc($id)." AND userid=".sqlesc($CURUSER['id']));
if (!$clickcount)
KPS("+",$adclickbonus_advertisement,$CURUSER['id']);
}
sql_query("INSERT INTO adclicks (adid, userid, added) VALUES (".sqlesc($id).", ".sqlesc($CURUSER['id']).", ".sqlesc(date("Y-m-d H:i:s")).")");
header("Location: $redir");
+13
View File
@@ -0,0 +1,13 @@
function $(e){if(typeof e=='string')e=document.getElementById(e);return e};
function collect(a,f){var n=[];for(var i=0;i<a.length;i++){var v=f(a[i]);if(v!=null)n.push(v)}return n};
ajax={};
ajax.x=function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest()}}};
ajax.serialize=function(f){var g=function(n){return f.getElementsByTagName(n)};var nv=function(e){if(e.name)return encodeURIComponent(e.name)+'='+encodeURIComponent(e.value);else return ''};var i=collect(g('input'),function(i){if((i.type!='radio'&&i.type!='checkbox')||i.checked)return nv(i)});var s=collect(g('select'),nv);var t=collect(g('textarea'),nv);return i.concat(s).concat(t).join('&');};
ajax.send=function(u,f,m,a){var x=ajax.x();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)f(x.responseText)};if(m=='POST')x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a)};
ajax.get=function(url,func){ajax.send(url,func,'GET')};
ajax.gets=function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x.responseText};
ajax.post=function(url,func,args){ajax.send(url,func,'POST',args)};
ajax.posts=function(url,args){var x=ajax.x(); x.open('POST',url,false); x.setRequestHeader('Content-type','application/x-www-form-urlencoded'); x.send(args); return x.responseText};
ajax.update=function(url,elm){var e=$(elm);var f=function(r){e.innerHTML=r};ajax.get(url,f)};
ajax.submit=function(url,elm,frm){var e=$(elm);var f=function(r){e.innerHTML=r};ajax.post(url,f,ajax.serialize(frm))};
+16
View File
@@ -0,0 +1,16 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_MODERATOR)
stderr("Error", "Permission denied.");
$res2 = sql_query("SELECT agent,peer_id FROM peers GROUP BY agent ") or sqlerr();
stdhead("All Clients");
print("<table align=center border=3 cellspacing=0 cellpadding=5>\n");
print("<tr><td class=colhead>Client</td><td class=colhead>Peer ID</td></tr>\n");
while($arr2 = mysql_fetch_assoc($res2))
{
print("</a></td><td align=left>$arr2[agent]</td><td align=left>$arr2[peer_id]</td></tr>\n");
}
print("</table>\n");
stdfoot();
+32
View File
@@ -0,0 +1,32 @@
<?php
//Allow Email Address registration
define("ALLOWEMAILVERSION", "Allow Email");
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_SYSOP)
stderr("Error", "Access denied.");
$action = isset($_POST['action']) ? htmlspecialchars($_POST['action']) : (isset($_GET['action']) ? htmlspecialchars($_GET['action']) : 'showlist');
if ($action == 'showlist') {
stdhead ("Show List");
print("<table border=1 cellspacing=0 cellpadding=5 width=737>\n");
$sql = sql_query("SELECT * FROM allowedemails") or sqlerr(__FILE__, __LINE__);
$list = mysql_fetch_array($sql);
?>
<form method=post action=allowedemails.php>
<input type=hidden name=action value=savelist>
<tr><td>Enter a list of allowed email addresses (separated by spaces):<br />To allow a specific address enter "email@domain.com", to allow an entire domain enter "@domain.com"</td>
<td><textarea name="value" rows="5" cols="40"><?php echo $list['value']?></textarea>
<input type=submit value="save"></form></td>
</tr></table>
<?php
stdfoot () ;
}elseif ($action == 'savelist') {
stdhead ("Save List");
$value = trim ( htmlspecialchars ( $_POST['value'] ) ) ;
sql_query("UPDATE allowedemails SET value = ".sqlesc($value)) or sqlerr(__FILE__, __LINE__);
Print ("Saved.");
stdfoot () ;
}
+56
View File
@@ -0,0 +1,56 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_MODERATOR)
stderr("Error", "Access denied.");
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if ($_POST['doit'] == 'yes') {
sql_query("UPDATE users SET seedbonus = seedbonus + 25.0 WHERE status='confirmed'");
stderr("Bonus", "25.0 bonus point is sent to everyone...");
die;
}
if ($_POST["username"] == "" || $_POST["seedbonus"] == "" || $_POST["seedbonus"] == "")
stderr("Error", "Missing form data.");
$username = sqlesc($_POST["username"]);
$seedbonus = sqlesc($_POST["seedbonus"]);
sql_query("UPDATE users SET seedbonus=seedbonus + $seedbonus WHERE username=$username") or sqlerr(__FILE__, __LINE__);
$res = sql_query("SELECT id FROM users WHERE username=$username");
$arr = mysql_fetch_row($res);
if (!$arr)
stderr("Error", "Unable to update account.");
header("Location: " . get_protocol_prefix() . "$BASEURL/userdetails.php?id=".htmlspecialchars($arr[0]));
die;
}
stdhead("Update Users Upload Amounts");
?>
<h1>Update Users Bonus Amounts</h1>
<?php
begin_main_frame("",false, 30);
begin_main_frame("Add to Specific User",false,30);
echo "<form method=\"post\" action=\"amountbonus.php\">";
print("<table width=100% border=1 cellspacing=0 cellpadding=5>\n");
?>
<tr><td class="rowhead">User name</td><td class="rowfollow"><input type="text" name="username" size="30"/></td></tr>
<tr><td class="rowhead">Bonus</td><td class="rowfollow"><input type="text" name="seedbonus" size="5"/></td></tr>
<tr><td colspan="2" class="toolbox" align="center"><input type="submit" value="Okay" class="btn"/></td></tr>
<?php end_table();?>
</form>
<?php end_main_frame();?>
<?php begin_main_frame("Send 25.0 bonus point to everyone",false,30);?>
<form action="amountbonus.php" method="post">
<table width=100% border=1 cellspacing=0 cellpadding=5>
<tr><td class="rowfollow" width="100%">
Are you sure you want to give all confirmed users 25.0 extra bonus point?<br /><br /></td></tr>
<tr><td class="toolbox" align="center"><input type = "hidden" name = "doit" value = "yes" />
<input type="submit" class="btn" value="Yes" />
</td></tr>
<?php end_table();?>
</form>
<?php
end_main_frame();
end_main_frame();
stdfoot();
+128
View File
@@ -0,0 +1,128 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_SYSOP)
stderr("Sorry", "Access denied.");
stdhead("Add Upload", false);
?>
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
<div align=center>
<h1>Add upload to all staff members and users:</a></h1>
<form method=post action=takeamountupload.php>
<?php
if (isset($_GET["returnto"]) || $_SERVER["HTTP_REFERER"])
{
?>
<input type=hidden name=returnto value="<?php echo htmlspecialchars($_GET["returnto"]) ? htmlspecialchars($_GET["returnto"]) : htmlspecialchars($_SERVER["HTTP_REFERER"])?>">
<?php
}
?>
<table cellspacing=0 cellpadding=5>
<?php
if (isset($_GET["sent"]) && $_GET["sent"] == 1) {
?>
<tr><td colspan=2 class="text" align="center"><font color=red><b>Upload amount has been added and inform message has been sent.</font></b></tr></td>
<?php
}
?>
<tr><td class="rowhead" valign="top">Amount </td><td class="rowfollow"><input type=text name=amount size=10>&nbsp;(in GB)</td></tr>
<tr>
<td class="rowhead" valign="top">Add to</td><td class="rowfollow">
<table style="border: 0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="0">
</td>
<td style="border: 0">Peasant</td>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="1">
</td>
<td style="border: 0">User</td>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="2">
</td>
<td style="border: 0">Power User</td>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="3">
</td>
<td style="border: 0">Elite User</td>
</tr>
<tr>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="4">
</td>
<td style="border: 0">Crazy User</td>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="5">
</td>
<td style="border: 0">Insane User</td>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="6">
</td>
<td style="border: 0">Veteran User</td>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="7">
</td>
<td style="border: 0">Extreme User</td>
</tr>
<tr>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="8">
</td>
<td style="border: 0">Ultimate User</td>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="9">
</td>
<td style="border: 0">Nexus Master</td>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="10">
</td>
<td style="border: 0">VIP</td>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="11">
</td>
<td style="border: 0">Uploader</td>
</tr>
<tr>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="12">
</td>
<td style="border: 0">Moderator</td>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="13">
</td>
<td style="border: 0">Administrator</td>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="14">
</td>
<td style="border: 0">SysOp</td>
<td style="border: 0" width="20"><input type="checkbox" name="clases[]" value="15">
</td>
<td style="border: 0">Staff Leader</td>
<td style="border: 0">&nbsp;</td>
<td style="border: 0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr><td class="rowhead" valign="top">Subject </td><td class="rowfollow"><input type=text name=subject size=82></td></tr>
<tr><td class="rowhead" valign="top">Reason </td><td class="rowfollow"><textarea name=msg cols=80 rows=5><?php echo $body ?? ''?></textarea></td></tr>
<tr>
<td class="rowfollow" colspan=2><div align="center"><b>Operator:&nbsp;&nbsp;</b>
<?php echo $CURUSER['username']?>
<input name="sender" type="radio" value="self" checked>
&nbsp; System
<input name="sender" type="radio" value="system">
</div></td></tr>
<tr><td class="rowfollow" colspan=2 align=center><input type=submit value="Do It!" class=btn></td></tr>
</table>
<input type=hidden name=receiver value=<?php echo $receiver ?? ''?>>
</form>
</div></td></tr></table>
<br />
NOTE: Do not user BB codes. (NO HTML)
<?php
stdfoot();
+392
View File
@@ -0,0 +1,392 @@
<?php
require_once('../include/bittorrent_announce.php');
require_once('include/benc.php');
dbconn_announce();
//1. BLOCK ACCESS WITH WEB BROWSERS AND CHEATS!
$agent = $_SERVER["HTTP_USER_AGENT"];
block_browser();
//2. GET ANNOUNCE VARIABLES
// get string type passkey, info_hash, peer_id, event, ip from client
foreach (array("passkey","info_hash","peer_id","event") as $x)
{
if(isset($_GET["$x"]))
$GLOBALS[$x] = $_GET[$x];
}
// get integer type port, downloaded, uploaded, left from client
foreach (array("port","downloaded","uploaded","left","compact","no_peer_id") as $x)
{
$GLOBALS[$x] = intval($_GET[$x] ?? 0);
}
//check info_hash, peer_id and passkey
foreach (array("passkey","info_hash","peer_id","port","downloaded","uploaded","left") as $x)
if (!isset($x)) err("Missing key: $x");
foreach (array("info_hash","peer_id") as $x)
if (strlen($GLOBALS[$x]) != 20) err("Invalid $x (" . strlen($GLOBALS[$x]) . " - " . rawurlencode($GLOBALS[$x]) . ")");
if (strlen($passkey) != 32) err("Invalid passkey (" . strlen($passkey) . " - $passkey)");
//4. GET IP AND CHECK PORT
$ip = getip(); // avoid to get the spoof ip from some agent
if (!$port || $port > 0xffff)
err("invalid port");
if (!ip2long($ip)) //Disable compact announce with IPv6
$compact = 0;
// check port and connectable
if (portblacklisted($port))
err("Port $port is blacklisted.");
//5. GET PEER LIST
// Number of peers that the client would like to receive from the tracker.This value is permitted to be zero. If omitted, typically defaults to 50 peers.
$rsize = 50;
foreach(array("numwant", "num want", "num_want") as $k)
{
if (isset($_GET[$k]))
{
$rsize = intval($_GET[$k] ?? 0);
break;
}
}
// set if seeder based on left field
$seeder = ($left == 0) ? "yes" : "no";
// check passkey
if (!$az = $Cache->get_value('user_passkey_'.$passkey.'_content')){
$res = sql_query("SELECT id, downloadpos, enabled, uploaded, downloaded, class, parked, clientselect, showclienterror FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");
$az = mysql_fetch_array($res);
$Cache->cache_value('user_passkey_'.$passkey.'_content', $az, 950);
}
if (!$az) err("Invalid passkey! Re-download the .torrent from $BASEURL");
$userid = intval($az['id'] ?? 0);
//3. CHECK IF CLIENT IS ALLOWED
$clicheck_res = check_client($peer_id,$agent,$client_familyid);
if($clicheck_res){
if ($az['showclienterror'] == 'no')
{
sql_query("UPDATE users SET showclienterror = 'yes' WHERE id = ".sqlesc($userid));
$Cache->delete_value('user_passkey_'.$passkey.'_content');
}
err($clicheck_res);
}
elseif ($az['showclienterror'] == 'yes'){
$USERUPDATESET[] = "showclienterror = 'no'";
$Cache->delete_value('user_passkey_'.$passkey.'_content');
}
// check torrent based on info_hash
if (!$torrent = $Cache->get_value('torrent_hash_'.$info_hash.'_content')){
$res = sql_query("SELECT id, owner, sp_state, seeders, leechers, UNIX_TIMESTAMP(added) AS ts, banned FROM torrents WHERE " . hash_where("info_hash", $info_hash));
$torrent = mysql_fetch_array($res);
$Cache->cache_value('torrent_hash_'.$info_hash.'_content', $torrent, 350);
}
if (!$torrent) err("torrent not registered with this tracker");
elseif ($torrent['banned'] == 'yes' && $az['class'] < $seebanned_class) err("torrent banned");
// select peers info from peers table for this torrent
$torrentid = $torrent["id"];
$numpeers = $torrent["seeders"]+$torrent["leechers"];
if ($seeder == 'yes'){ //Don't report seeds to other seeders
$only_leech_query = " AND seeder = 'no' ";
$newnumpeers = $torrent["leechers"];
}
else{
$only_leech_query = "";
$newnumpeers = $numpeers;
}
if ($newnumpeers > $rsize)
$limit = " ORDER BY RAND() LIMIT $rsize";
else $limit = "";
$announce_wait = 30;
$fields = "seeder, peer_id, ip, port, uploaded, downloaded, (".TIMENOW." - UNIX_TIMESTAMP(last_action)) AS announcetime, UNIX_TIMESTAMP(prev_action) AS prevts";
$peerlistsql = "SELECT ".$fields." FROM peers WHERE torrent = ".$torrentid." AND connectable = 'yes' ".$only_leech_query.$limit;
$res = sql_query($peerlistsql);
$real_annnounce_interval = $announce_interval;
if ($anninterthreeage && ($anninterthree > $announce_wait) && (TIMENOW - $torrent['ts']) >= ($anninterthreeage * 86400))
$real_annnounce_interval = $anninterthree;
elseif ($annintertwoage && ($annintertwo > $announce_wait) && (TIMENOW - $torrent['ts']) >= ($annintertwoage * 86400))
$real_annnounce_interval = $annintertwo;
$resp = "d" . benc_str("interval") . "i" . $real_annnounce_interval . "e" . benc_str("min interval") . "i" . $announce_wait . "e". benc_str("complete") . "i" . $torrent["seeders"] . "e" . benc_str("incomplete") . "i" . $torrent["leechers"] . "e" . benc_str("peers");
$peer_list = "";
unset($self);
// bencoding the peers info get for this announce
while ($row = mysql_fetch_assoc($res))
{
$row["peer_id"] = hash_pad($row["peer_id"]);
// $peer_id is the announcer's peer_id while $row["peer_id"] is randomly selected from the peers table
if ($row["peer_id"] === $peer_id)
{
$self = $row;
continue;
}
if ($compact == 1){
$longip = ip2long($row['ip']);
if ($longip) //Ignore ipv6 address
$peer_list .= pack("Nn", sprintf("%d",$longip), $row['port']);
}
elseif ($no_peer_id == 1)
$peer_list .= "d" .
benc_str("ip") . benc_str($row["ip"]) .
benc_str("port") . "i" . $row["port"] . "e" .
"e";
else
$peer_list .= "d" .
benc_str("ip") . benc_str($row["ip"]) .
benc_str("peer id") . benc_str($row["peer_id"]) .
benc_str("port") . "i" . $row["port"] . "e" .
"e";
}
if ($compact == 1)
$resp .= benc_str($peer_list);
else
$resp .= "l".$peer_list."e";
$resp .= "e";
$selfwhere = "torrent = $torrentid AND " . hash_where("peer_id", $peer_id);
//no found in the above random selection
if (!isset($self))
{
$res = sql_query("SELECT $fields FROM peers WHERE $selfwhere LIMIT 1");
$row = mysql_fetch_assoc($res);
if ($row)
{
$self = $row;
}
}
// min announce time
if(isset($self) && $self['prevts'] > (TIMENOW - $announce_wait))
err('There is a minimum announce time of ' . $announce_wait . ' seconds');
// current peer_id, or you could say session with tracker not found in table peers
if (!isset($self))
{
$valid = @mysql_fetch_row(@sql_query("SELECT COUNT(*) FROM peers WHERE torrent=$torrentid AND userid=" . sqlesc($userid)));
if ($valid[0] >= 1 && $seeder == 'no') err("You already are downloading the same torrent. You may only leech from one location at a time.");
if ($valid[0] >= 3 && $seeder == 'yes') err("You cannot seed the same torrent from more than 3 locations.");
if ($az["enabled"] == "no")
err("Your account is disabled!");
elseif ($az["parked"] == "yes")
err("Your account is parked! (Read the FAQ)");
elseif ($az["downloadpos"] == "no")
err("Your downloading priviledges have been disabled! (Read the rules)");
if ($az["class"] < UC_VIP)
{
$ratio = (($az["downloaded"] > 0) ? ($az["uploaded"] / $az["downloaded"]) : 1);
$gigs = $az["downloaded"] / (1024*1024*1024);
if ($waitsystem == "yes")
{
if($gigs > 10)
{
$elapsed = strtotime(date("Y-m-d H:i:s")) - $torrent["ts"];
if ($ratio < 0.4) $wait = 24;
elseif ($ratio < 0.5) $wait = 12;
elseif ($ratio < 0.6) $wait = 6;
elseif ($ratio < 0.8) $wait = 3;
else $wait = 0;
if ($elapsed < $wait)
err("Your ratio is too low! You need to wait " . mkprettytime($wait * 3600 - $elapsed) . " to start, please read $BASEURL/faq.php#id46 for details");
}
}
if ($maxdlsystem == "yes")
{
if($gigs > 10)
if ($ratio < 0.5) $max = 1;
elseif ($ratio < 0.65) $max = 2;
elseif ($ratio < 0.8) $max = 3;
elseif ($ratio < 0.95) $max = 4;
else $max = 0;
if ($max > 0)
{
$res = sql_query("SELECT COUNT(*) AS num FROM peers WHERE userid='$userid' AND seeder='no'") or err("Tracker error 5");
$row = mysql_fetch_assoc($res);
if ($row['num'] >= $max) err("Your slot limit is reached! You may at most download $max torrents at the same time, please read $BASEURL/faq.php#id66 for details");
}
}
}
}
else // continue an existing session
{
$upthis = $trueupthis = max(0, $uploaded - $self["uploaded"]);
$downthis = $truedownthis = max(0, $downloaded - $self["downloaded"]);
$announcetime = ($self["seeder"] == "yes" ? "seedtime = seedtime + $self[announcetime]" : "leechtime = leechtime + $self[announcetime]");
$is_cheater = false;
if ($cheaterdet_security){
if ($az['class'] < $nodetect_security && $self['announcetime'] > 10)
{
$is_cheater = check_cheater($userid, $torrent['id'], $upthis, $downthis, $self['announcetime'], $torrent['seeders'], $torrent['leechers']);
}
}
if (!$is_cheater && ($trueupthis > 0 || $truedownthis > 0))
{
$global_promotion_state = get_global_sp_state();
if($global_promotion_state == 1)// Normal, see individual torrent
{
if($torrent['sp_state']==3) //2X
{
$USERUPDATESET[] = "uploaded = uploaded + 2*$trueupthis";
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis";
}
elseif($torrent['sp_state']==4) //2X Free
{
$USERUPDATESET[] = "uploaded = uploaded + 2*$trueupthis";
}
elseif($torrent['sp_state']==6) //2X 50%
{
$USERUPDATESET[] = "uploaded = uploaded + 2*$trueupthis";
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis/2";
}
else{
if ($torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
$upthis = $trueupthis * $uploaderdouble_torrent;
if($torrent['sp_state']==2) //Free
{
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
}
elseif($torrent['sp_state']==5) //50%
{
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis/2";
}
elseif($torrent['sp_state']==7) //30%
{
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis*3/10";
}
elseif($torrent['sp_state']==1) //Normal
{
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis";
}
}
}
elseif($global_promotion_state == 2) //Free
{
if ($torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
$upthis = $trueupthis * $uploaderdouble_torrent;
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
}
elseif($global_promotion_state == 3) //2X
{
if ($uploaderdouble_torrent > 2 && $torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
$upthis = $trueupthis * $uploaderdouble_torrent;
else $upthis = 2*$trueupthis;
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis";
}
elseif($global_promotion_state == 4) //2X Free
{
if ($uploaderdouble_torrent > 2 && $torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
$upthis = $trueupthis * $uploaderdouble_torrent;
else $upthis = 2*$trueupthis;
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
}
elseif($global_promotion_state == 5){ // 50%
if ($torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
$upthis = $trueupthis * $uploaderdouble_torrent;
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis/2";
}
elseif($global_promotion_state == 6){ //2X 50%
if ($uploaderdouble_torrent > 2 && $torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
$upthis = $trueupthis * $uploaderdouble_torrent;
else $upthis = 2*$trueupthis;
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis/2";
}
elseif($global_promotion_state == 7){ //30%
if ($torrent['owner'] == $userid && $uploaderdouble_torrent > 0)
$upthis = $trueupthis * $uploaderdouble_torrent;
$USERUPDATESET[] = "uploaded = uploaded + $upthis";
$USERUPDATESET[] = "downloaded = downloaded + $truedownthis*3/10";
}
}
}
$dt = sqlesc(date("Y-m-d H:i:s"));
$updateset = array();
// set non-type event
if (!isset($event))
$event = "";
if (isset($self) && $event == "stopped")
{
sql_query("DELETE FROM peers WHERE $selfwhere") or err("D Err");
if (mysql_affected_rows())
{
$updateset[] = ($self["seeder"] == "yes" ? "seeders = seeders - 1" : "leechers = leechers - 1");
sql_query("UPDATE snatched SET uploaded = uploaded + $trueupthis, downloaded = downloaded + $truedownthis, to_go = $left, $announcetime, last_action = ".$dt." WHERE torrentid = $torrentid AND userid = $userid") or err("SL Err 1");
}
}
elseif(isset($self))
{
if ($event == "completed")
{
//sql_query("UPDATE snatched SET finished = 'yes', completedat = $dt WHERE torrentid = $torrentid AND userid = $userid");
$finished = ", finishedat = ".TIMENOW;
$finished_snatched = ", completedat = ".$dt . ", finished = 'yes'";
$updateset[] = "times_completed = times_completed + 1";
}
sql_query("UPDATE peers SET ip = ".sqlesc($ip).", port = $port, uploaded = $uploaded, downloaded = $downloaded, to_go = $left, prev_action = last_action, last_action = $dt, seeder = '$seeder', agent = ".sqlesc($agent)." $finished WHERE $selfwhere") or err("PL Err 1");
if (mysql_affected_rows())
{
if ($seeder <> $self["seeder"])
$updateset[] = ($seeder == "yes" ? "seeders = seeders + 1, leechers = leechers - 1" : "seeders = seeders - 1, leechers = leechers + 1");
sql_query("UPDATE snatched SET uploaded = uploaded + $trueupthis, downloaded = downloaded + $truedownthis, to_go = $left, $announcetime, last_action = ".$dt." $finished_snatched WHERE torrentid = $torrentid AND userid = $userid") or err("SL Err 2");
}
}
else
{
$sockres = @pfsockopen($ip, $port, $errno, $errstr, 5);
if (!$sockres)
{
$connectable = "no";
}
else
{
$connectable = "yes";
@fclose($sockres);
}
sql_query("INSERT INTO peers (torrent, userid, peer_id, ip, port, connectable, uploaded, downloaded, to_go, started, last_action, seeder, agent, downloadoffset, uploadoffset, passkey) VALUES ($torrentid, $userid, ".sqlesc($peer_id).", ".sqlesc($ip).", $port, '$connectable', $uploaded, $downloaded, $left, $dt, $dt, '$seeder', ".sqlesc($agent).", $downloaded, $uploaded, ".sqlesc($passkey).")") or err("PL Err 2");
if (mysql_affected_rows())
{
$updateset[] = ($seeder == "yes" ? "seeders = seeders + 1" : "leechers = leechers + 1");
$check = @mysql_fetch_row(@sql_query("SELECT COUNT(*) FROM snatched WHERE torrentid = $torrentid AND userid = $userid"));
if (!$check['0'])
sql_query("INSERT INTO snatched (torrentid, userid, ip, port, uploaded, downloaded, to_go, startdat, last_action) VALUES ($torrentid, $userid, ".sqlesc($ip).", $port, $uploaded, $downloaded, $left, $dt, $dt)") or err("SL Err 4");
else
sql_query("UPDATE snatched SET to_go = $left, last_action = ".$dt ." WHERE torrentid = $torrentid AND userid = $userid") or err("SL Err 3.1");
}
}
if (count($updateset)) // Update only when there is change in peer counts
{
$updateset[] = "visible = 'yes'";
$updateset[] = "last_action = $dt";
sql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid");
}
if($client_familyid != 0 && $client_familyid != $az['clientselect'])
$USERUPDATESET[] = "clientselect = ".sqlesc($client_familyid);
if(count($USERUPDATESET) && $userid)
{
sql_query("UPDATE users SET " . join(",", $USERUPDATESET) . " WHERE id = ".$userid);
}
benc_resp_raw($resp);
?>
+264
View File
@@ -0,0 +1,264 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
include_once($rootpath . 'classes/class_attachment.php');
$Attach = new ATTACHMENT($CURUSER['id']);
$count_limit = $Attach->get_count_limit();
$count_limit = (int)$count_limit;
$count_left = $Attach->get_count_left();
$size_limit = $Attach->get_size_limit_byte();
$allowed_exts = $Attach->get_allowed_ext();
$css_uri = get_css_uri();
$altsize = $_POST['altsize'] ?? '';
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="<?php echo get_font_css_uri()?>" type="text/css">
<link rel="stylesheet" href="<?php echo $css_uri."theme.css"?>" type="text/css">
</head>
<body class="inframe">
<table width="100%">
<?php
$warning = "";
if ($Attach->enable_attachment())
{
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$file = $_FILES['file'];
$filesize = $file["size"];
$filetype = $file["type"];
$origfilename = $file['name'];
$ext_l = strrpos($origfilename, ".");
$ext = strtolower(substr($origfilename, $ext_l+1, strlen($origfilename)-($ext_l+1)));
$banned_ext = array('exe', 'com', 'bat', 'msi');
$img_ext = array('jpeg', 'jpg', 'png', 'gif');
if (!$file || $filesize == 0 || $file["name"] == "") // nothing received
{
$warning = $lang_attachment['text_nothing_received'];
}
elseif (!$count_left) //user cannot upload more files
{
$warning = $lang_attachment['text_file_number_limit_reached'];
}
elseif ($filesize > $size_limit || $filesize >= 5242880) //do not allow file bigger than 5 MB
{
$warning = $lang_attachment['text_file_size_too_big'];
}
elseif (!in_array($ext, $allowed_exts) || in_array($ext, $banned_ext)) //the file extension is banned
{
$warning = $lang_attachment['text_file_extension_not_allowed'];
}
else //everythins is okay
{
if (in_array($ext, $img_ext))
$isimage = true;
else $isimage = false;
if ($savedirectorytype_attachment == 'onedir')
$savepath = "";
elseif ($savedirectorytype_attachment == 'monthdir')
$savepath = date("Ym")."/";
elseif ($savedirectorytype_attachment == 'daydir')
$savepath = date("Ymd")."/";
$filemd5 = md5_file($file['tmp_name']);
$filename = date("YmdHis").$filemd5;
$file_location = make_folder($savedirectory_attachment."/", $savepath) . $filename;
$db_file_location = $savepath.$filename;
$abandonorig = false;
$hasthumb = false;
$width = 0;
if ($isimage) //the uploaded file is a image
{
$maycreatethumb = false;
$stop = false;
$imagesize = getimagesize($file['tmp_name']);
if ($imagesize){
$height = $imagesize[1];
$width = $imagesize[0];
$it = $imagesize[2];
if ($it != 1 || !$Attach->is_gif_ani($file['tmp_name'])){ //if it is an animation GIF, stop creating thumbnail and adding watermark
if ($thumbnailtype_attachment != 'no') //create thumbnail for big image
{
//determine the size of thumbnail
if ($altsize == 'yes'){
$targetwidth = $altthumbwidth_attachment;
$targetheight = $altthumbheight_attachment;
}
else
{
$targetwidth = $thumbwidth_attachment;
$targetheight = $thumbheight_attachment;
}
$hscale=$height/$targetheight;
$wscale=$width/$targetwidth;
$scale=($hscale < 1 && $wscale < 1) ? 1 : (( $hscale > $wscale) ? $hscale : $wscale);
$newwidth=floor($width/$scale);
$newheight=floor($height/$scale);
if ($scale != 1){ //thumbnail is needed
if ($it==1)
$orig=@imagecreatefromgif($file["tmp_name"]);
elseif ($it == 2)
$orig=@imagecreatefromjpeg($file["tmp_name"]);
else
$orig=@imagecreatefrompng($file["tmp_name"]);
if ($orig && !$stop)
{
$thumb = imagecreatetruecolor($newwidth, $newheight);
imagecopyresized($thumb, $orig, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
if ($thumbnailtype_attachment == 'createthumb'){
$hasthumb = true;
imagejpeg($thumb, $file_location.".".$ext.".thumb.jpg", $thumbquality_attachment);
}
elseif ($thumbnailtype_attachment == 'resizebigimg'){
$ext = "jpg";
$filetype = "image/jpeg";
$it = 2;
$height = $newheight;
$width = $newwidth;
$maycreatethumb = true;
$abandonorig = true;
}
}
}
}
$watermarkpos = $watermarkpos_attachment;
if ($watermarkpos != 'no' && !$stop) //add watermark to image
{
if ($width > $watermarkwidth_attachment && $height > $watermarkheight_attachment)
{
if ($abandonorig)
{
$resource = $thumb;
}
else
{
$resource=imagecreatetruecolor($width,$height);
if ($it==1)
$resource_p=@imagecreatefromgif($file["tmp_name"]);
elseif ($it==2)
$resource_p=@imagecreatefromjpeg($file["tmp_name"]);
else
$resource_p=@imagecreatefrompng($file["tmp_name"]);
imagecopy($resource, $resource_p, 0, 0, 0, 0, $width, $height);
}
$watermark = imagecreatefrompng('pic/watermark.png');
$watermark_width = imagesx($watermark);
$watermark_height = imagesy($watermark);
//the position of the watermark
if ($watermarkpos == 'random')
$watermarkpos = mt_rand(1, 9);
switch ($watermarkpos)
{
case 1: {
$wmx = 5;
$wmy = 5;
break;
}
case 2: {
$wmx = ($width-$watermark_width)/2;
$wmy = 5;
break;
}
case 3: {
$wmx = $width-$watermark_width-5;
$wmy = 5;
break;
}
case 4: {
$wmx = 5;
$wmy = ($height-$watermark_height)/2;
break;
}
case 5: {
$wmx = ($width-$watermark_width)/2;
$wmy = ($height-$watermark_height)/2;
break;
}
case 6: {
$wmx = $width-$watermark_width-5;
$wmy = ($height-$watermark_height)/2;
break;
}
case 7: {
$wmx = 5;
$wmy = $height-$watermark_height-5;
break;
}
case 8: {
$wmx = ($width-$watermark_width)/2;
$wmy = $height-$watermark_height-5;
break;
}
case 9: {
$wmx = $width-$watermark_width-5;
$wmy = $height-$watermark_height-5;
break;
}
}
imagecopy($resource, $watermark, $wmx, $wmy, 0, 0, $watermark_width, $watermark_height);
if ($it==1)
imagegif($resource, $file_location.".".$ext);
elseif ($it==2)
imagejpeg($resource, $file_location.".".$ext, $watermarkquality_attachment);
else
imagepng($resource, $file_location.".".$ext);
$filesize = filesize($file_location.".".$ext);
$maycreatethumb = false;
$abandonorig = true;
}
}
if ($maycreatethumb){ // if no watermark is added, create the thumbnail now for the above resized image.
imagejpeg($thumb, $file_location.".".$ext, $thumbquality_attachment);
$filesize = filesize($file_location.".".$ext);
}
}
}
else $warning = $lang_attachment['text_invalid_image_file'];
}
if (!$abandonorig){
if(!move_uploaded_file($file["tmp_name"], $file_location.".".$ext))
$warning = $lang_attachment['text_cannot_move_file'];
}
if (!$warning) //insert into database and add code to editor
{
$dlkey = md5($db_file_location.".".$ext);
sql_query("INSERT INTO attachments (userid, width, added, filename, filetype, filesize, location, dlkey, isimage, thumb) VALUES (".$CURUSER['id'].", ".$width.", ".sqlesc(date("Y-m-d H:i:s")).", ".sqlesc($origfilename).", ".sqlesc($filetype).", ".$filesize.", ".sqlesc($db_file_location.".".$ext).", ".sqlesc($dlkey).", ".($isimage ? 1 : 0).", ".($hasthumb ? 1 : 0).")") or sqlerr(__FILE__, __LINE__);
$count_left--;
echo("<script type=\"text/javascript\">parent.tag_extimage('". "[attach]" . $dlkey . "[/attach]" . "');</script>");
}
}
}
print("<form enctype=\"multipart/form-data\" name=\"attachment\" method=\"post\" action=\"attachment.php\">");
print("<tr>");
print("<td class=\"embedded\" colspan=\"2\" align=left>");
print("<input type=\"file\" name=\"file\"".($count_left ? "" : " disabled=\"disabled\"")." />&nbsp;");
print("<input type=\"checkbox\" name=\"altsize\" value=\"yes\"".($altsize == 'yes' ? " checked=\"checked\"" : "")." />".$lang_attachment['text_small_thumbnail']."&nbsp;");
print("<input type=\"submit\" name=\"submit\" value=\"".$lang_attachment['submit_upload']."\"".($count_left ? "" : " disabled=\"disabled\"")." /> ");
if ($warning) {
print('<span class="striking">'.$warning.'</span>');
} else {
print("<b>".$lang_attachment['text_left']."</b><font color=\"red\">".$count_left."</font>".$lang_attachment['text_of'].$count_limit."&nbsp;&nbsp;&nbsp;<b>".$lang_attachment['text_size_limit']."</b>".mksize($size_limit)."&nbsp;&nbsp;&nbsp;<b>".$lang_attachment['text_file_extensions']."</b>");
$allowedextsblock = "";
foreach($allowed_exts as $ext) {
$allowedextsblock .= $ext."/";
}
$allowedextsblock = rtrim(trim($allowedextsblock), "/");
if (!$allowedextsblock) {
$allowedextsblock = 'N/A';
}
print("<span title=\"".htmlspecialchars($allowedextsblock)."\"><i>".$lang_attachment['text_mouse_over_here']."</i></span>");
}
print("</td>");
print("</tr>");
print("</form>");
}
?>
</table>
</body>
</html>
+30
View File
@@ -0,0 +1,30 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_SYSOP)
stderr("Error", "Access denied.");
$action = isset($_POST['action']) ? htmlspecialchars($_POST['action']) : (isset($_GET['action']) ? htmlspecialchars($_GET['action']) : 'showlist');
if ($action == 'showlist') {
stdhead (VERSION." - Show List");
print("<table border=1 cellspacing=0 cellpadding=5 width=737>\n");
$sql = sql_query("SELECT * FROM bannedemails") or sqlerr(__FILE__, __LINE__);
$list = mysql_fetch_array($sql);
?>
<form method=post action=bannedemails.php>
<input type=hidden name=action value=savelist>
<tr><td>Enter a list of banned email addresses (separated by spaces):<br />To ban a specific address enter "email@domain.com", to ban an entire domain enter "@domain.com"</td>
<td><textarea name="value" rows="5" cols="40"><?php echo $list['value']?></textarea>
<input type=submit value="save"></form></td>
</tr></table>
<?php
stdfoot () ;
}elseif ($action == 'savelist') {
stdhead (VERSION." - Save List");
$value = trim ( htmlspecialchars ( $_POST['value'] ?? '' ) ) ;
sql_query("UPDATE bannedemails SET value = ".sqlesc($value)) or sqlerr(__FILE__, __LINE__);
Print ("Saved.");
stdfoot () ;
}
+71
View File
@@ -0,0 +1,71 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_ADMINISTRATOR)
stderr("Sorry", "Access denied.");
$remove = intval($_GET['remove'] ?? 0);
if (is_valid_id($remove))
{
sql_query("DELETE FROM bans WHERE id=".mysql_real_escape_string($remove)) or sqlerr();
write_log("Ban ".htmlspecialchars($remove)." was removed by {$CURUSER['id']} ($CURUSER[username])",'mod');
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && get_user_class() >= UC_ADMINISTRATOR)
{
$first = trim($_POST["first"]);
$last = trim($_POST["last"]);
$comment = trim($_POST["comment"]);
if (!$first || !$last || !$comment)
stderr("Error", "Missing form data.");
$firstlong = ip2long($first);
$lastlong = ip2long($last);
if ($firstlong == -1 || $lastlong == -1)
stderr("Error", "Bad IP address.");
$comment = sqlesc($comment);
$added = sqlesc(date("Y-m-d H:i:s"));
sql_query("INSERT INTO bans (added, addedby, first, last, comment) VALUES($added, ".mysql_real_escape_string($CURUSER['id']).", $firstlong, $lastlong, $comment)") or sqlerr(__FILE__, __LINE__);
header("Location: {$_SERVER['REQUEST_URI']}");
die;
}
//ob_start("ob_gzhandler");
$res = sql_query("SELECT * FROM bans ORDER BY added DESC") or sqlerr();
stdhead("Bans");
print("<h1>Current Bans</h1>\n");
if (mysql_num_rows($res) == 0)
print("<p align=center><b>Nothing found</b></p>\n");
else
{
print("<table border=1 cellspacing=0 cellpadding=5>\n");
print("<tr><td class=colhead>Added</td><td class=colhead align=left>First IP</td><td class=colhead align=left>Last IP</td>".
"<td class=colhead align=left>By</td><td class=colhead align=left>Comment</td><td class=colhead>Remove</td></tr>\n");
while ($arr = mysql_fetch_assoc($res))
{
print("<tr><td>".gettime($arr['added'])."</td><td align=left>".long2ip($arr['first'])."</td><td align=left>".long2ip($arr['last'])."</td><td align=left>". get_username($arr['addedby']) .
"</td><td align=left>{$arr['comment']}</td><td><a href=bans.php?remove={$arr['id']}>Remove</a></td></tr>\n");
}
print("</table>\n");
}
if (get_user_class() >= UC_ADMINISTRATOR)
{
print("<h1>Add ban</h1>\n");
print("<table border=1 cellspacing=0 cellpadding=5>\n");
print("<form method=post action=bans.php>\n");
print("<tr><td class=rowhead>First IP</td><td><input type=text name=first size=40></td></tr>\n");
print("<tr><td class=rowhead>Last IP</td><td><input type=text name=last size=40></td></tr>\n");
print("<tr><td class=rowhead>Comment</td><td><input type=text name=comment size=40></td></tr>\n");
print("<tr><td colspan=2 align=center><input type=submit value='Okay' class=btn></td></tr>\n");
print("</form>\n</table>\n");
}
stdfoot();
?>
+83
View File
@@ -0,0 +1,83 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
parked();
if ($enablebitbucket_main != 'yes')
permissiondenied();
$maxfilesize = 256 * 1024;
$imgtypes = array (null,'gif','jpg','png');
$scaleh = 200; // set our height size desired
$scalew = 150; // set our width size desired
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$file = $_FILES["file"];
if (!isset($file) || $file["size"] < 1)
stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_nothing_received']);
if ($file["size"] > $maxfilesize)
stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_file_too_large']);
$pp=pathinfo($filename = $file["name"]);
if($pp['basename'] != $filename)
stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_bad_file_name']);
$tgtfile = "$bitbucket/$filename";
if (file_exists($tgtfile))
stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_file_already_exists'].htmlspecialchars($filename).$lang_bitbucketupload['std_already_exists'],false);
$size = getimagesize($file["tmp_name"]);
$height = $size[1];
$width = $size[0];
$it = $size[2];
if($imgtypes[$it] == null || $imgtypes[$it] != strtolower($pp['extension']))
stderr($lang_bitbucketupload['std_error'], $lang_bitbucketupload['std_invalid_image_format'],false);
// Scale image to appropriate avatar dimensions
$hscale=$height/$scaleh;
$wscale=$width/$scalew;
$scale=($hscale < 1 && $wscale < 1) ? 1 : (( $hscale > $wscale) ? $hscale : $wscale);
$newwidth=floor($width/$scale);
$newheight=floor($height/$scale);
if ($it==1)
$orig=@imagecreatefromgif($file["tmp_name"]);
elseif ($it == 2)
$orig=@imagecreatefromjpeg($file["tmp_name"]);
else
$orig=@imagecreatefrompng($file["tmp_name"]);
if(!$orig)
stderr($lang_bitbucketupload['std_image_processing_failed'],$lang_bitbucketupload['std_sorry_the_uploaded']."$imgtypes[$it]".$lang_bitbucketupload['std_failed_processing']);
$thumb = imagecreatetruecolor($newwidth, $newheight);
imagecopyresized($thumb, $orig, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$ret=($it==1)?imagegif($thumb, $tgtfile): ($it==2)?imagejpeg($thumb, $tgtfile):imagepng($thumb, $tgtfile);
$url = str_replace(" ", "%20", htmlspecialchars(get_protocol_prefix()."$BASEURL/bitbucket/$filename"));
$name = sqlesc($filename);
$added = sqlesc(date("Y-m-d H:i:s"));
if ($_POST['public'] != 'yes' )
$public='"0"';
else
$public='"1"';
sql_query("INSERT INTO bitbucket (owner, name, added, public) VALUES ($CURUSER[id], $name, $added, $public)") or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE users SET avatar = ".sqlesc($url)." WHERE id = $CURUSER[id]") or sqlerr(__FILE__, __LINE__);
stderr($lang_bitbucketupload['std_success'], $lang_bitbucketupload['std_use_following_url']."<br /><b><a href=\"$url\">$url</a></b><p><a href=bitbucket-upload.php>".$lang_bitbucketupload['std_upload_another_file']."</a>.<br /><br /><img src=\"$url\" border=0><br /><br />".$lang_bitbucketupload['std_image']. ($width=$newwidth && $height==$newheight ? $lang_bitbucketupload['std_need_not_rescaling']:$lang_bitbucketupload['std_rescaled_from']."$height x $width".$lang_bitbucketupload['std_to']."$newheight x $newwidth") .$lang_bitbucketupload['std_profile_updated'],false);
}
stdhead($lang_bitbucketupload['head_avatar_upload']);
?>
<h1><?php echo $lang_bitbucketupload['text_avatar_upload'] ?></h1>
<form method="post" action=bitbucket-upload.php enctype="multipart/form-data">
<table border=1 cellspacing=0 cellpadding=5>
<?php
if(!is_writable("$bitbucket"))
print("<tr><td align=left colspan=2>".$lang_bitbucketupload['text_upload_directory_unwritable']."</tr></td>");
print("<tr><td align=left colspan=2>".$lang_bitbucketupload['text_disclaimer']."$scaleh".$lang_bitbucketupload['text_disclaimer_two']."$scalew".$lang_bitbucketupload['text_disclaimer_three'].number_format($maxfilesize).$lang_bitbucketupload['text_disclaimer_four']);
?>
<tr><td class=rowhead><?php echo $lang_bitbucketupload['row_file'] ?></td><td class="rowfollow"><input type="file" name="file" size="60"></td></tr>
<tr><td colspan=2 align=left class="toolbox"><input class="checkbox" type=checkbox name=public value=yes><?php echo $lang_bitbucketupload['checkbox_avatar_shared']?> <input type="submit" value=<?php echo $lang_bitbucketupload['submit_upload'] ?>></td></tr>
</table>
</form>
<?php
stdfoot();
+53
View File
@@ -0,0 +1,53 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
parked();
if (get_user_class() < UC_ADMINISTRATOR)
stderr("Sorry", "Access denied.");
$bucketpath = "$bitbucket";
if (get_user_class() >= UC_MODERATOR)
{
$delete = intval($_GET["delete"] ?? 0);
if (is_valid_id($delete)) {
$r = sql_query("SELECT name,owner FROM bitbucket WHERE id=".mysql_real_escape_string($delete)) or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($r) == 1) {
$a = mysql_fetch_assoc($r);
if (get_user_class() >= UC_MODERATOR || $a["owner"] == $CURUSER["id"]) {
sql_query("DELETE FROM bitbucket WHERE id=".mysql_real_escape_string($delete)) or sqlerr(__FILE__, __LINE__);
if (!unlink("$bucketpath/$a[name]"))
stderr("Warning", "Unable to unlink file: <b>$a[name]</b>. You should contact an administrator about this error.",false);
} } } }
stdhead("BitBucket Log");
$res = sql_query("SELECT count(*) FROM bitbucket") or die(mysql_error()); $row = mysql_fetch_array($res); $count = $row[0];
$perpage = 10;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] . "?out=" . ($_GET["out"] ?? '') . "&" );
print("<h1>BitBucket Log</h1>\n");
print("Total Images Stored: $count");
echo $pagertop;
$res = sql_query("SELECT * FROM bitbucket ORDER BY added DESC $limit") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print("<b>BitBucket Log is empty</b>\n");
else {
print("<table align='center' border='0' cellspacing='0' cellpadding='5'>\n");
while ($arr = mysql_fetch_assoc($res)) {
$date = substr($arr['added'], 0, strpos($arr['added'], " "));
$time = substr($arr['added'], strpos($arr['added'], " ") + 1);
$name = $arr["name"];
list($width, $height, $type, $attr) = getimagesize("" . get_protocol_prefix() . "$BASEURL/$bitbucket/$name");
$url = str_replace(" ", "%20", htmlspecialchars("$bitbucket/$name"));
print("<tr>");
print("<td><center><a href=$url><img src=\"".$url."\" border=0 onLoad='SetSize(this, 400)'></a></center>");
print("Uploaded by: " . get_username($arr['owner']). "<br />");
print("(#{$arr['id']}) Filename: $name ($width&nbsp;x&nbsp;$height)");
if (get_user_class() >= UC_MODERATOR)
print(" <b><a href=?delete=$arr[id]>[Delete]</a></b><br />");
print("Added: $date $time");
print("</tr>");
}
print("</table>");
}
echo
$pagerbottom;
stdfoot();
?>
+28
View File
@@ -0,0 +1,28 @@
<?php
require "../include/bittorrent.php";
dbconn();
//Send some headers to keep the user's browser from caching the response.
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
header("Cache-Control: no-cache, must-revalidate" );
header("Pragma: no-cache" );
header("Content-Type: text/xml; charset=utf-8");
$torrentid = intval($_GET['torrentid'] ?? 0);
if(isset($CURUSER))
{
$res_bookmark = sql_query("SELECT * FROM bookmarks WHERE torrentid=" . sqlesc($torrentid) . " AND userid=" . sqlesc($CURUSER[id]));
if (mysql_num_rows($res_bookmark) == 1){
sql_query("DELETE FROM bookmarks WHERE torrentid=" . sqlesc($torrentid) . " AND userid=" . sqlesc($CURUSER['id'])) or sqlerr(__FILE__,__LINE__);
$Cache->delete_value('user_'.$CURUSER['id'].'_bookmark_array');
echo "deleted";
}
else{
sql_query("INSERT INTO bookmarks (torrentid, userid) VALUES (" . sqlesc($torrentid) . "," . sqlesc($CURUSER['id']) . ")") or sqlerr(__FILE__,__LINE__);
$Cache->delete_value('user_'.$CURUSER['id'].'_bookmark_array');
echo "added";
}
}
else echo "failed";
?>
+790
View File
@@ -0,0 +1,790 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
if (get_user_class() < UC_ADMINISTRATOR)
permissiondenied();
function return_category_db_table_name($type)
{
switch($type)
{
case 'category':
$dbtablename = 'categories';
break;
case 'source':
$dbtablename = 'sources';
break;
case 'medium':
$dbtablename = 'media';
break;
case 'codec':
$dbtablename = 'codecs';
break;
case 'standard':
$dbtablename = 'standards';
break;
case 'processing':
$dbtablename = 'processings';
break;
case 'team':
$dbtablename = 'teams';
break;
case 'audiocodec':
$dbtablename = 'audiocodecs';
break;
case 'searchbox':
$dbtablename = 'searchbox';
break;
case 'secondicon':
$dbtablename = 'secondicons';
break;
case 'caticon':
$dbtablename = 'caticons';
break;
default:
return false;
}
return $dbtablename;
}
function return_category_mode_selection($selname, $selectionid)
{
$res = sql_query("SELECT * FROM searchbox ORDER BY id ASC");
$selection = "<select name=\"".$selname."\">";
while ($row = mysql_fetch_array($res))
$selection .= "<option value=\"" . $row["id"] . "\"". ($row["id"]==$selectedid ? " selected=\"selected\"" : "").">" . htmlspecialchars($row["name"]) . "</option>\n";
$selection .= "</select>";
return $selection;
}
function return_type_name($type)
{
global $lang_catmanage;
switch ($type)
{
case 'searchbox':
$name = $lang_catmanage['text_searchbox'];
break;
case 'caticon':
$name = $lang_catmanage['text_category_icons'];
break;
case 'secondicon':
$name = $lang_catmanage['text_second_icons'];
break;
case 'category':
$name = $lang_catmanage['text_categories'];
break;
case 'source':
$name = $lang_catmanage['text_sources'];
break;
case 'medium':
$name = $lang_catmanage['text_media'];
break;
case 'codec':
$name = $lang_catmanage['text_codecs'];
break;
case 'standard':
$name = $lang_catmanage['text_standards'];
break;
case 'processing':
$name = $lang_catmanage['text_processings'];
break;
case 'team':
$name = $lang_catmanage['text_teams'];
break;
case 'audiocodec':
$name = $lang_catmanage['text_audio_codecs'];
break;
default:
return false;
}
return $name;
}
function print_type_list($type){
global $lang_catmanage;
$typename=return_type_name($type);
stdhead($lang_catmanage['head_category_management']." - ".$typename);
begin_main_frame();
?>
<h1 align="center"><?php echo $lang_catmanage['text_category_management']?> - <?php echo $typename?></h1>
<div>
<span id="item" onclick="dropmenu(this);"><span style="cursor: pointer;" class="big"><b><?php echo $lang_catmanage['text_manage']?></b></span>
<div id="itemlist" class="dropmenu" style="display: none"><ul>
<li><a href="?action=view&amp;type=searchbox"><?php echo $lang_catmanage['text_searchbox']?></a></li>
<li><a href="?action=view&amp;type=caticon"><?php echo $lang_catmanage['text_category_icons']?></a></li>
<li><a href="?action=view&amp;type=secondicon"><?php echo $lang_catmanage['text_second_icons']?></a></li>
<li><a href="?action=view&amp;type=category"><?php echo $lang_catmanage['text_categories']?></a></li>
<li><a href="?action=view&amp;type=source"><?php echo $lang_catmanage['text_sources']?></a></li>
<li><a href="?action=view&amp;type=medium"><?php echo $lang_catmanage['text_media']?></a></li>
<li><a href="?action=view&amp;type=codec"><?php echo $lang_catmanage['text_codecs']?></a></li>
<li><a href="?action=view&amp;type=standard"><?php echo $lang_catmanage['text_standards']?></a></li>
<li><a href="?action=view&amp;type=processing"><?php echo $lang_catmanage['text_processings']?></a></li>
<li><a href="?action=view&amp;type=team"><?php echo $lang_catmanage['text_teams']?></a></li>
<li><a href="?action=view&amp;type=audiocodec"><?php echo $lang_catmanage['text_audio_codecs']?></a></li>
</ul>
</div>
</span>
&nbsp;&nbsp;&nbsp;&nbsp;
<span id="add">
<a href="?action=add&amp;type=<?php echo $type?>" class="big"><b><?php echo $lang_catmanage['text_add']?></b></a>
</span>
</div>
<?php
}
function check_valid_type($type)
{
global $lang_catmanage;
$validtype=array('searchbox', 'caticon', 'secondicon', 'category', 'source', 'medium', 'codec', 'standard', 'processing', 'team', 'audiocodec');
if (!in_array($type, $validtype))
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_type']);
}
function print_sub_category_list($type)
{
global $lang_catmanage;
$dbtablename = return_category_db_table_name($type);
$perpage = 50;
$num = get_row_count($dbtablename);
if (!$num)
print("<p align=\"center\">".$lang_catmanage['text_no_record_yet']."</p>");
else{
list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?");
$res = sql_query("SELECT * FROM ".$dbtablename." ORDER BY id DESC ".$limit) or sqlerr(__FILE__, __LINE__);
?>
<table border="1" cellspacing="0" cellpadding="5" width="940">
<tr>
<td class="colhead"><?php echo $lang_catmanage['col_id']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_name']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_order']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_action']?></td>
</tr>
<?php
while ($row = mysql_fetch_array($res))
{
?>
<tr>
<td class="colfollow"><?php echo $row['id']?></td>
<td class="colfollow"><?php echo htmlspecialchars($row['name'])?></td>
<td class="colfollow"><?php echo $row['sort_index']?></td>
<td class="colfollow"><a href="javascript:confirm_delete('<?php echo $row['id']?>', '<?php echo $lang_catmanage['js_sure_to_delete_this']?>', 'type=<?php echo $type?>');"><?php echo $lang_catmanage['text_delete']?></a> | <a href="?action=edit&amp;type=<?php echo $type?>&amp;id=<?php echo $row['id']?>"><?php echo $lang_catmanage['text_edit']?></a></td>
</tr>
<?php
}
?>
</table>
<?php
print($pagerbottom);
}
}
function print_category_editor($type, $row='')
{
global $lang_catmanage;
global $validsubcattype;
if (in_array($type, $validsubcattype))
print_sub_category_editor($type, $row);
else
{
$typename=return_type_name($type);
?>
<div style="width: 940px">
<h1 align="center"><a class="faqlink" href="?action=view&amp;type=<?php echo $type?>"><?php echo $typename?></a></h1>
<div>
<table border="1" cellspacing="0" cellpadding="10" width="100%">
<?php
if ($type=='searchbox')
{
if ($row)
{
$name = $row['name'];
$showsource = $row['showsource'];
$showmedium = $row['showmedium'];
$showcodec = $row['showcodec'];
$showstandard = $row['showstandard'];
$showprocessing = $row['showprocessing'];
$showteam = $row['showteam'];
$showaudiocodec = $row['showaudiocodec'];
$catsperrow = $row['catsperrow'];
$catpadding = $row['catpadding'];
}
else
{
$name = '';
$showsource = 0;
$showmedium = 0;
$showcodec = 0;
$showstandard = 0;
$showprocessing = 0;
$showteam = 0;
$showaudiocodec = 0;
$catsperrow = 8;
$catpadding = 3;
}
tr($lang_catmanage['row_searchbox_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"name\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_catmanage['text_searchbox_name_note'], 1);
tr($lang_catmanage['row_show_sub_category'], "<input type=\"checkbox\" name=\"showsource\" value=\"1\"".($showsource ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_sources'] . "<input type=\"checkbox\" name=\"showmedium\" value=\"1\"".($showmedium ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_media'] . "<input type=\"checkbox\" name=\"showcodec\" value=\"1\"".($showcodec ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_codecs'] . "<input type=\"checkbox\" name=\"showstandard\" value=\"1\"".($showstandard ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_standards'] . "<input type=\"checkbox\" name=\"showprocessing\" value=\"1\"".($showprocessing ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_processings'] . "<input type=\"checkbox\" name=\"showteam\" value=\"1\"".($showteam ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_teams'] . "<input type=\"checkbox\" name=\"showaudiocodec\" value=\"1\"".($showaudiocodec ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_audio_codecs']."<br />".$lang_catmanage['text_show_sub_category_note'], 1);
tr($lang_catmanage['row_items_per_row']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"catsperrow\" value=\"".$catsperrow."\" style=\"width: 100px\" /> " . $lang_catmanage['text_items_per_row_note'], 1);
tr($lang_catmanage['row_padding_between_items']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"catpadding\" value=\"".$catpadding."\" style=\"width: 100px\" /> " . $lang_catmanage['text_padding_between_items_note'], 1);
}
elseif ($type=='caticon')
{
if ($row)
{
$name = $row['name'];
$folder = $row['folder'];
$multilang = $row['multilang'];
$secondicon = $row['secondicon'];
$cssfile = $row['cssfile'];
$designer = $row['designer'];
$comment = $row['comment'];
}
else
{
$name = '';
$folder = '';
$multilang = 'no';
$secondicon = 'no';
$cssfile = '';
$designer = '';
$comment = '';
}
?>
<tr><td colspan="2"><?php echo $lang_catmanage['text_icon_directory_note']?></td></tr>
<?php
tr($lang_catmanage['col_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"name\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_catmanage['text_category_icon_name_note'], 1);
tr($lang_catmanage['col_folder']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"folder\" value=\"".htmlspecialchars($folder)."\" style=\"width: 300px\" /><br />" . $lang_catmanage['text_folder_note'], 1);
tr($lang_catmanage['text_multi_language'], "<input type=\"checkbox\" name=\"multilang\" value=\"yes\"".($multilang == 'yes' ? " checked=\"checked\"" : "")." />".$lang_catmanage['text_yes'] ."<br />". $lang_catmanage['text_multi_language_note'], 1);
tr($lang_catmanage['text_second_icon'], "<input type=\"checkbox\" name=\"secondicon\" value=\"yes\"".($secondicon == 'yes' ? " checked=\"checked\"" : "")." />".$lang_catmanage['text_yes'] ."<br />". $lang_catmanage['text_second_icon_note'], 1);
tr($lang_catmanage['text_css_file'], "<input type=\"text\" name=\"cssfile\" value=\"".htmlspecialchars($cssfile)."\" style=\"width: 300px\" /> ". $lang_catmanage['text_css_file_note'], 1);
tr($lang_catmanage['text_designer'], "<input type=\"text\" name=\"designer\" value=\"".htmlspecialchars($designer)."\" style=\"width: 300px\" /> ". $lang_catmanage['text_designer_note'], 1);
tr($lang_catmanage['text_comment'], "<input type=\"text\" name=\"comment\" value=\"".htmlspecialchars($comment)."\" style=\"width: 300px\" /> ". $lang_catmanage['text_comment_note'], 1);
}
elseif ($type=='secondicon')
{
if ($row)
{
$name = $row['name'];
$image = $row['image'];
$class_name = $row['class_name'];
$source = $row['source'];
$medium = $row['medium'];
$codec = $row['codec'];
$standard = $row['standard'];
$processing = $row['processing'];
$team = $row['team'];
$audiocodec = $row['audiocodec'];
}
else
{
$name = '';
$image = '';
$class_name = '';
$source = 0;
$medium = 0;
$codec = 0;
$standard = 0;
$processing = 0;
$team = 0;
$audiocodec = 0;
}
tr($lang_catmanage['col_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"name\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_catmanage['text_second_icon_name_note'], 1);
tr($lang_catmanage['col_image']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"image\" value=\"".htmlspecialchars($image)."\" style=\"width: 300px\" /><br />" . $lang_catmanage['text_image_note'], 1);
tr($lang_catmanage['text_class_name'], "<input type=\"text\" name=\"class_name\" value=\"".htmlspecialchars($class_name)."\" style=\"width: 300px\" /><br />" . $lang_catmanage['text_class_name_note'], 1);
tr($lang_catmanage['row_selections']."<font color=\"red\">*</font>", torrent_selection(return_type_name('source'), 'source', return_category_db_table_name('source'), $source) . torrent_selection(return_type_name('source'), 'source', return_category_db_table_name('source'), $source) . torrent_selection(return_type_name('medium'), 'medium', return_category_db_table_name('medium'), $medium) . torrent_selection(return_type_name('codec'), 'codec', return_category_db_table_name('codec'), $codec) . torrent_selection(return_type_name('standard'), 'standard', return_category_db_table_name('standard'), $standard) . torrent_selection(return_type_name('processing'), 'processing', return_category_db_table_name('processing'), $processing) . torrent_selection(return_type_name('team'), 'team', return_category_db_table_name('team'), $team) . torrent_selection(return_type_name('audiocodec'), 'audiocodec', return_category_db_table_name('audiocodec'), $audiocodec)."<br />".$lang_catmanage['text_selections_note'], 1);
}
elseif ($type=='category')
{
if ($row)
{
$name = $row['name'];
$mode = $row['mode'];
$image = $row['image'];
$class_name = $row['class_name'];
$sort_index = $row['sort_index'];
}
else
{
$name = '';
$mode = 1;
$image = '';
$class_name = '';
$sort_index = 0;
}
tr($lang_catmanage['row_category_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"name\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_catmanage['text_category_name_note'], 1);
tr($lang_catmanage['col_image']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"image\" value=\"".htmlspecialchars($image)."\" style=\"width: 300px\" /><br />" . $lang_catmanage['text_image_note'], 1);
tr($lang_catmanage['text_class_name'], "<input type=\"text\" name=\"class_name\" value=\"".htmlspecialchars($class_name)."\" style=\"width: 300px\" /><br />" . $lang_catmanage['text_class_name_note'], 1);
tr($lang_catmanage['row_mode']."<font color=\"red\">*</font>", return_category_mode_selection('mode', $mode), 1);
tr($lang_catmanage['col_order'], "<input type=\"text\" name=\"sort_index\" value=\"".$sort_index."\" style=\"width: 100px\" /> " . $lang_catmanage['text_order_note'], 1);
}
?>
</table>
</div>
<div style="text-align: center; margin-top: 10px;">
<input type="submit" value="<?php echo $lang_catmanage['submit_submit']?>" />
</div>
</div>
<?php
}
}
function print_sub_category_editor($type, $row='')
{
global $lang_catmanage;
$typename=return_type_name($type);
if ($row)
{
$name = $row['name'];
$sort_index = $row['sort_index'];
}
else
{
$name = '';
$sort_index = 0;
}
?>
<div style="width: 940px">
<h1 align="center"><a class="faqlink" href="?action=view&amp;type=<?php echo $type?>"><?php echo $typename?></a></h1>
<table border="1" cellspacing="0" cellpadding="10" width="100%">
<?php
tr($lang_catmanage['col_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"name\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_catmanage['text_subcategory_name_note'], 1);
tr($lang_catmanage['col_order'], "<input type=\"text\" name=\"sort_index\" value=\"".$sort_index."\" style=\"width: 100px\" /> " . $lang_catmanage['text_order_note'], 1);
?>
</table>
<div style="text-align: center; margin-top: 10px;">
<input type="submit" value="<?php echo $lang_catmanage['submit_submit']?>" />
</div>
</div>
<?php
}
$validsubcattype=array('source', 'medium', 'codec', 'standard', 'processing', 'team', 'audiocodec');
$type = $_GET['type'] ?? '';
if ($type == '')
$type = 'searchbox';
else
check_valid_type($type);
$action = $_GET['action'] ?? '';
if ($action == '')
$action = 'view';
if ($action == 'view')
{
print_type_list($type);
?>
<div style="margin-top: 8px">
<?php
if (in_array($type, $validsubcattype)){
print_sub_category_list($type);
}
elseif ($type=='searchbox')
{
$perpage = 50;
$dbtablename=return_category_db_table_name($type);
$num = get_row_count($dbtablename);
if (!$num)
print("<p align=\"center\">".$lang_catmanage['text_no_record_yet']."</p>");
else{
list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?");
$res = sql_query("SELECT * FROM ".$dbtablename." ORDER BY id ASC ".$limit) or sqlerr(__FILE__, __LINE__);
?>
<table border="1" cellspacing="0" cellpadding="5" width="940">
<tr>
<td class="colhead"><?php echo $lang_catmanage['col_id']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_name']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_sub_category']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_sources']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_media']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_codecs']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_standards']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_processings']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_teams']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_audio_codecs']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_per_row']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_padding']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_action']?></td>
</tr>
<?php
while ($row = mysql_fetch_array($res))
{
?>
<tr>
<td class="colfollow"><?php echo $row['id']?></td>
<td class="colfollow"><?php echo htmlspecialchars($row['name'])?></td>
<td class="colfollow"><?php echo $row['showsubcat'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
<td class="colfollow"><?php echo $row['showsource'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
<td class="colfollow"><?php echo $row['showmedium'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
<td class="colfollow"><?php echo $row['showcodec'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
<td class="colfollow"><?php echo $row['showstandard'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
<td class="colfollow"><?php echo $row['showprocessing'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
<td class="colfollow"><?php echo $row['showteam'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
<td class="colfollow"><?php echo $row['showaudiocodec'] ? "<font color=\"green\">".$lang_catmanage['text_enabled']."</font>" : "<font color=\"red\">".$lang_catmanage['text_disabled']."</font>"?></td>
<td class="colfollow"><?php echo $row['catsperrow']?></td>
<td class="colfollow"><?php echo $row['catpadding']?></td>
<td class="colfollow"><a href="javascript:confirm_delete('<?php echo $row['id']?>', '<?php echo $lang_catmanage['js_sure_to_delete_this']?>', 'type=<?php echo $type?>');"><?php echo $lang_catmanage['text_delete']?></a> | <a href="?action=edit&amp;type=<?php echo $type?>&amp;id=<?php echo $row['id']?>"><?php echo $lang_catmanage['text_edit']?></a></td>
</tr>
<?php
}
?>
</table>
<?php
print($pagerbottom);
}
}
elseif($type=='caticon')
{
$perpage = 50;
$dbtablename=return_category_db_table_name($type);
$num = get_row_count($dbtablename);
if (!$num)
print("<p align=\"center\">".$lang_catmanage['text_no_record_yet']."</p>");
else{
list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?");
$res = sql_query("SELECT * FROM ".$dbtablename." ORDER BY id ASC ".$limit) or sqlerr(__FILE__, __LINE__);
?>
<table border="1" cellspacing="0" cellpadding="5" width="940">
<tr>
<td class="colhead"><?php echo $lang_catmanage['col_id']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_name']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_folder']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_multi_language']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_second_icon']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_css_file']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_designer']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_comment']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_action']?></td>
</tr>
<?php
while ($row = mysql_fetch_array($res))
{
?>
<tr>
<td class="colfollow"><?php echo $row['id']?></td>
<td class="colfollow"><?php echo htmlspecialchars($row['name'])?></td>
<td class="colfollow"><?php echo htmlspecialchars($row['folder'])?></td>
<td class="colfollow"><?php echo $row['multilang']=='yes' ? "<font color=\"green\">".$lang_catmanage['text_yes']."</font>" : "<font color=\"red\">".$lang_catmanage['text_no']."</font>"?></td>
<td class="colfollow"><?php echo $row['secondicon']=='yes' ? "<font color=\"green\">".$lang_catmanage['text_yes']."</font>" : "<font color=\"red\">".$lang_catmanage['text_no']."</font>"?></td>
<td class="colfollow"><?php echo $row['cssfile'] ? htmlspecialchars($row['cssfile']) : $lang_catmanage['text_none']?></td>
<td class="colfollow"><?php echo htmlspecialchars($row['designer'])?></td>
<td class="colfollow"><?php echo htmlspecialchars($row['comment'])?></td>
<td class="colfollow"><a href="javascript:confirm_delete('<?php echo $row['id']?>', '<?php echo $lang_catmanage['js_sure_to_delete_this']?>', 'type=<?php echo $type?>');"><?php echo $lang_catmanage['text_delete']?></a> | <a href="?action=edit&amp;type=<?php echo $type?>&amp;id=<?php echo $row['id']?>"><?php echo $lang_catmanage['text_edit']?></a></td>
</tr>
<?php
}
?>
</table>
<?php
print($pagerbottom);
}
}
elseif($type=='secondicon')
{
$perpage = 50;
$dbtablename=return_category_db_table_name($type);
$num = get_row_count($dbtablename);
if (!$num)
print("<p align=\"center\">".$lang_catmanage['text_no_record_yet']."</p>");
else{
list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?");
$res = sql_query("SELECT * FROM ".$dbtablename." ORDER BY id ASC ".$limit) or sqlerr(__FILE__, __LINE__);
?>
<table border="1" cellspacing="0" cellpadding="5" width="940">
<tr>
<td class="colhead"><?php echo $lang_catmanage['col_id']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_name']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_image']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_class_name']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_sources']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_media']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_codecs']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_standards']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_processings']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_teams']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_audio_codecs']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_action']?></td>
</tr>
<?php
while ($row = mysql_fetch_array($res))
{
?>
<tr>
<td class="colfollow"><?php echo $row['id']?></td>
<td class="colfollow"><?php echo htmlspecialchars($row['name'])?></td>
<td class="colfollow"><?php echo htmlspecialchars($row['image'])?></td>
<td class="colfollow"><?php echo $row['class_name'] ? htmlspecialchars($row['class_name']) : $lang_catmanage['text_none']?></td>
<td class="colfollow"><?php echo $row['source']?></td>
<td class="colfollow"><?php echo $row['medium']?></td>
<td class="colfollow"><?php echo $row['codec']?></td>
<td class="colfollow"><?php echo $row['standard']?></td>
<td class="colfollow"><?php echo $row['processing']?></td>
<td class="colfollow"><?php echo $row['team']?></td>
<td class="colfollow"><?php echo $row['audiocodec']?></td>
<td class="colfollow"><a href="javascript:confirm_delete('<?php echo $row['id']?>', '<?php echo $lang_catmanage['js_sure_to_delete_this']?>', 'type=<?php echo $type?>');"><?php echo $lang_catmanage['text_delete']?></a> | <a href="?action=edit&amp;type=<?php echo $type?>&amp;id=<?php echo $row['id']?>"><?php echo $lang_catmanage['text_edit']?></a></td>
</tr>
<?php
}
?>
</table>
<?php
print($pagerbottom);
}
}
elseif($type=='category')
{
$perpage = 50;
$dbtablename=return_category_db_table_name($type);
$num = get_row_count($dbtablename);
if (!$num)
print("<p align=\"center\">".$lang_catmanage['text_no_record_yet']."</p>");
else{
list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?");
$res = sql_query("SELECT ".$dbtablename.".*, searchbox.name AS catmodename FROM ".$dbtablename." LEFT JOIN searchbox ON ".$dbtablename.".mode=searchbox.id ORDER BY ".$dbtablename.".mode ASC, ".$dbtablename.".id ASC ".$limit) or sqlerr(__FILE__, __LINE__);
?>
<table border="1" cellspacing="0" cellpadding="5" width="940">
<tr>
<td class="colhead"><?php echo $lang_catmanage['col_id']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_mode']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_name']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_image']?></td>
<td class="colhead"><?php echo $lang_catmanage['text_class_name']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_order']?></td>
<td class="colhead"><?php echo $lang_catmanage['col_action']?></td>
</tr>
<?php
while ($row = mysql_fetch_array($res))
{
?>
<tr>
<td class="colfollow"><?php echo $row['id']?></td>
<td class="colfollow"><?php echo htmlspecialchars($row['catmodename'])?></td>
<td class="colfollow"><?php echo htmlspecialchars($row['name'])?></td>
<td class="colfollow"><?php echo htmlspecialchars($row['image'])?></td>
<td class="colfollow"><?php echo $row['class_name'] ? htmlspecialchars($row['class_name']) : $lang_catmanage['text_none']?></td>
<td class="colfollow"><?php echo $row['sort_index']?></td>
<td class="colfollow"><a href="javascript:confirm_delete('<?php echo $row['id']?>', '<?php echo $lang_catmanage['js_sure_to_delete_this']?>', 'type=<?php echo $type?>');"><?php echo $lang_catmanage['text_delete']?></a> | <a href="?action=edit&amp;type=<?php echo $type?>&amp;id=<?php echo $row['id']?>"><?php echo $lang_catmanage['text_edit']?></a></td>
</tr>
<?php
}
?>
</table>
<?php
print($pagerbottom);
}
}
?>
</div>
<?php
end_main_frame();
stdfoot();
}
elseif($action == 'del')
{
$id = intval($_GET['id'] ?? 0);
if (!$id)
{
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_id']);
}
$dbtablename=return_category_db_table_name($type);
$res = sql_query ("SELECT * FROM ".$dbtablename." WHERE id = ".sqlesc($id)." LIMIT 1");
if ($row = mysql_fetch_array($res)){
sql_query("DELETE FROM ".$dbtablename." WHERE id = ".sqlesc($row['id'])) or sqlerr(__FILE__, __LINE__);
if(in_array($type, $validsubcattype))
$Cache->delete_value($dbtablename.'_list');
elseif ($type=='searchbox')
$Cache->delete_value('searchbox_content');
elseif ($type=='caticon')
$Cache->delete_value('category_icon_content');
elseif ($type=='secondicon')
$Cache->delete_value('secondicon_'.$row['source'].'_'.$row['medium'].'_'.$row['codec'].'_'.$row['standard'].'_'.$row['processing'].'_'.$row['team'].'_'.$row['audiocodec'].'_content');
elseif ($type=='category'){
$Cache->delete_value('category_content');
$Cache->delete_value('category_list_mode_'.$row['mode']);
}
}
header("Location: ".get_protocol_prefix() . $BASEURL."/catmanage.php?action=view&type=".$type);
die();
}
elseif($action == 'edit')
{
$id = intval($_GET['id'] ?? 0);
if (!$id)
{
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_id']);
}
else
{
$dbtablename=return_category_db_table_name($type);
$res = sql_query ("SELECT * FROM ".$dbtablename." WHERE id = ".sqlesc($id)." LIMIT 1");
if (!$row = mysql_fetch_array($res))
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_id']);
else
{
$typename=return_type_name($type);
stdhead($lang_catmanage['head_edit']." - ".$typename);
print("<form method=\"post\" action=\"?action=submit&amp;type=".$type."\">");
print("<input type=\"hidden\" name=\"isedit\" value=\"1\" />");
print("<input type=\"hidden\" name=\"id\" value=\"".$id."\" />");
print_category_editor($type, $row);
print("</form>");
stdfoot();
}
}
}
elseif($action == 'add')
{
$typename=return_type_name($type);
stdhead($lang_catmanage['head_add']." - ".$typename);
print("<form method=\"post\" action=\"?action=submit&amp;type=".$type."\">");
print("<input type=\"hidden\" name=\"isedit\" value=\"0\" />");
print_category_editor($type);
print("</form>");
stdfoot();
}
elseif($action == 'submit')
{
$dbtablename=return_category_db_table_name($type);
if ($_POST['isedit']){
$id = intval($_POST['id'] ?? 0);
if (!$id)
{
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_id']);
}
else
{
$res = sql_query("SELECT * FROM ".$dbtablename." WHERE id = ".sqlesc($id)." LIMIT 1");
if (!$row = mysql_fetch_array($res))
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_id']);
}
}
$updateset = array();
if (in_array($type, $validsubcattype)){
$name = $_POST['name'];
if (!$name)
stderr($lang_catmanage['std_error'], $lang_catmanage['std_missing_form_data']);
$updateset[] = "name=".sqlesc($name);
$sort_index = intval($_POST['sort_index'] ?? 0);
$updateset[] = "sort_index=".sqlesc($sort_index);
$Cache->delete_value($dbtablename.'_list');
}
elseif ($type=='searchbox'){
$name = $_POST['name'];
$catsperrow = intval($_POST['catsperrow'] ?? 0);
$catpadding = intval($_POST['catpadding'] ?? 0);
if (!$name || !$catsperrow || !$catpadding)
stderr($lang_catmanage['std_error'], $lang_catmanage['std_missing_form_data']);
$showsource = intval($_POST['showsource'] ?? 0);
$showmedium = intval($_POST['showmedium'] ?? 0);
$showcodec = intval($_POST['showcodec'] ?? 0);
$showstandard = intval($_POST['showstandard'] ?? 0);
$showprocessing = intval($_POST['showprocessing'] ?? 0);
$showteam = intval($_POST['showteam'] ?? 0);
$showaudiocodec = $_POST['showaudiocodec'];
$updateset[] = "catsperrow=".sqlesc($catsperrow);
$updateset[] = "catpadding=".sqlesc($catpadding);
$updateset[] = "name=".sqlesc($name);
$updateset[] = "showsource=".sqlesc($showsource);
$updateset[] = "showmedium=".sqlesc($showmedium);
$updateset[] = "showcodec=".sqlesc($showcodec);
$updateset[] = "showstandard=".sqlesc($showstandard);
$updateset[] = "showprocessing=".sqlesc($showprocessing);
$updateset[] = "showteam=".sqlesc($showteam);
$updateset[] = "showaudiocodec=".sqlesc($showaudiocodec);
if ($showsource || $showmedium || $showcodec || $showstandard || $showprocessing || $showteam || $showaudiocodec)
$updateset[] = "showsubcat=1";
else
$updateset[] = "showsubcat=0";
if($_POST['isedit'])
$Cache->delete_value('searchbox_content');
}
elseif ($type=='caticon'){
$name = $_POST['name'];
$folder = trim($_POST['folder']);
$cssfile = trim($_POST['cssfile']);
$multilang = ($_POST['multilang'] == 'yes' ? 'yes' : 'no');
$secondicon = ($_POST['secondicon'] == 'yes' ? 'yes' : 'no');
$designer = $_POST['designer'];
$comment = $_POST['comment'];
if (!$name || !$folder)
stderr($lang_catmanage['std_error'], $lang_catmanage['std_missing_form_data']);
if (!valid_file_name($folder))
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_character_in_filename'].htmlspecialchars($folder));
if ($cssfile && !valid_file_name($cssfile))
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_character_in_filename'].htmlspecialchars($cssfile));
$updateset[] = "name=".sqlesc($name);
$updateset[] = "folder=".sqlesc($folder);
$updateset[] = "multilang=".sqlesc($multilang);
$updateset[] = "secondicon=".sqlesc($secondicon);
$updateset[] = "cssfile=".sqlesc($cssfile);
$updateset[] = "designer=".sqlesc($designer);
$updateset[] = "comment=".sqlesc($comment);
if($_POST['isedit'])
$Cache->delete_value('category_icon_content');
}
elseif ($type=='secondicon'){
$name = $_POST['name'];
$image = trim($_POST['image']);
$class_name = trim($_POST['class_name']);
$source = intval($_POST['source'] ?? 0);
$medium = intval($_POST['medium'] ?? 0);
$codec = intval($_POST['codec'] ?? 0);
$standard = intval($_POST['standard'] ?? 0);
$processing = intval($_POST['processing'] ?? 0);
$team = intval($_POST['team'] ?? 0);
$audiocodec = intval($_POST['audiocodec'] ?? 0);
if (!$name || !$image)
stderr($lang_catmanage['std_error'], $lang_catmanage['std_missing_form_data']);
if (!valid_file_name($image))
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_character_in_filename'].htmlspecialchars($image));
if ($class_name && !valid_class_name($class_name))
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_character_in_filename'].htmlspecialchars($class_name));
if (!$source && !$medium && !$codec && !$standard && !$processing && !$team && !$audiocodec)
stderr($lang_catmanage['std_error'], $lang_catmanage['std_must_define_one_selection']);
$updateset[] = "name=".sqlesc($name);
$updateset[] = "image=".sqlesc($image);
$updateset[] = "class_name=".sqlesc($class_name);
$updateset[] = "medium=".sqlesc($medium);
$updateset[] = "codec=".sqlesc($codec);
$updateset[] = "standard=".sqlesc($standard);
$updateset[] = "processing=".sqlesc($processing);
$updateset[] = "team=".sqlesc($team);
$updateset[] = "audiocodec=".sqlesc($audiocodec);
if($_POST['isedit']){
$res2=sql_query("SELECT * FROM secondicons WHERE id=".sqlesc($id)." LIMIT 1");
if ($row2=mysql_fetch_array($res))
{
$Cache->delete_value('secondicon_'.$row2['source'].'_'.$row2['medium'].'_'.$row2['codec'].'_'.$row2['standard'].'_'.$row2['processing'].'_'.$row2['team'].'_'.$row2['audiocodec'].'_content');
}
}
$Cache->delete_value('secondicon_'.$source.'_'.$medium.'_'.$codec.'_'.$standard.'_'.$processing.'_'.$team.'_'.$audiocodec.'_content');
}
elseif ($type=='category'){
$name = $_POST['name'];
$image = trim($_POST['image']);
$mode = intval($_POST['mode'] ?? 0);
$class_name = trim($_POST['class_name']);
$sort_index = intval($_POST['sort_index'] ?? 0);
if (!$name || !$image)
stderr($lang_catmanage['std_error'], $lang_catmanage['std_missing_form_data']);
if (!valid_file_name($image))
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_character_in_filename'].htmlspecialchars($image));
if ($class_name && !valid_class_name($class_name))
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_character_in_filename'].htmlspecialchars($class_name));
if (!$mode)
stderr($lang_catmanage['std_error'], $lang_catmanage['std_invalid_mode_id']);
$updateset[] = "name=".sqlesc($name);
$updateset[] = "image=".sqlesc($image);
$updateset[] = "mode=".sqlesc($mode);
$updateset[] = "class_name=".sqlesc($class_name);
$updateset[] = "sort_index=".sqlesc($sort_index);
if($_POST['isedit']){
$Cache->delete_value('category_content');
}
$Cache->delete_value('category_list_mode_'.$mode);
}
if ($_POST['isedit'])
{
sql_query("UPDATE ".$dbtablename." SET " . join(",", $updateset) . " WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
}
else
{
sql_query("INSERT INTO ".$dbtablename." SET " . join(",", $updateset) ) or sqlerr(__FILE__, __LINE__);
}
header("Location: ".get_protocol_prefix() . $BASEURL."/catmanage.php?action=view&type=".$type);
}
?>
+129
View File
@@ -0,0 +1,129 @@
<?php
require "../include/bittorrent.php";
dbconn();
$pattern = "/.*cc98bar\.php\/(nn([0,1]{1}))?(nr([0-9]+))?(ng([0-9]+))?(nb([0-9]+))?(ns([1-5]{1}))?(nx([0-9]+))?(ny([0-9]+))?(nu([0,1]{1}))?(ur([0-9]+))?(ug([0-9]+))?(ub([0-9]+))?(us([1-5]{1}))?(ux([0-9]+))?(uy([0-9]+))?(nd([0,1]{1}))?(dr([0-9]+))?(dg([0-9]+))?(db([0-9]+))?(ds([1-5]{1}))?(dx([0-9]+))?(dy([0-9]+))?(bg([0-9]+))?id([0-9]+)\.png$/i";
if (!preg_match($pattern, $_SERVER['REQUEST_URI'])){
echo "Error! Invalid URL format.";
die;
}
if (!$my_img = $Cache->get_value('userbar_'.$_SERVER['REQUEST_URI'])){
$nn = preg_replace($pattern, "\\2", $_SERVER['REQUEST_URI']);
$nr = preg_replace($pattern, "\\4", $_SERVER['REQUEST_URI']);
$ng = preg_replace($pattern, "\\6", $_SERVER['REQUEST_URI']);
$nb = preg_replace($pattern, "\\8", $_SERVER['REQUEST_URI']);
$ns = preg_replace($pattern, "\\10", $_SERVER['REQUEST_URI']);
$nx = preg_replace($pattern, "\\12", $_SERVER['REQUEST_URI']);
$ny = preg_replace($pattern, "\\14", $_SERVER['REQUEST_URI']);
$nu = preg_replace($pattern, "\\16", $_SERVER['REQUEST_URI']);
$ur = preg_replace($pattern, "\\18", $_SERVER['REQUEST_URI']);
$ug = preg_replace($pattern, "\\20", $_SERVER['REQUEST_URI']);
$ub = preg_replace($pattern, "\\22", $_SERVER['REQUEST_URI']);
$us = preg_replace($pattern, "\\24", $_SERVER['REQUEST_URI']);
$ux = preg_replace($pattern, "\\26", $_SERVER['REQUEST_URI']);
$uy = preg_replace($pattern, "\\28", $_SERVER['REQUEST_URI']);
$nd = preg_replace($pattern, "\\30", $_SERVER['REQUEST_URI']);
$dr = preg_replace($pattern, "\\32", $_SERVER['REQUEST_URI']);
$dg = preg_replace($pattern, "\\34", $_SERVER['REQUEST_URI']);
$db = preg_replace($pattern, "\\36", $_SERVER['REQUEST_URI']);
$ds = preg_replace($pattern, "\\38", $_SERVER['REQUEST_URI']);
$dx = preg_replace($pattern, "\\40", $_SERVER['REQUEST_URI']);
$dy = preg_replace($pattern, "\\42", $_SERVER['REQUEST_URI']);
$bg = (int)preg_replace($pattern, "\\44", $_SERVER['REQUEST_URI']);
$id = preg_replace($pattern, "\\45", $_SERVER['REQUEST_URI']);
$res = sql_query("SELECT username, uploaded, downloaded, class, privacy FROM users WHERE id=".sqlesc($id)." LIMIT 1");
$row = mysql_fetch_array($res);
if (!$row)
die;
elseif($row['privacy'] == 'strong')
die;
elseif($row['class'] < $userbar_class)
die;
else{
$username = $row['username'];
$uploaded = mksize($row['uploaded']);
$downloaded = mksize($row['downloaded']);
}
$my_img=imagecreatefrompng("pic/userbar/".$bg.".png");
imagealphablending($my_img, false);
if (!$nn)
{
if ($nr != "" && $nr >=0 && $nr <=255)
$namered = $nr;
else $namered=255;
if ($ng != "" && $ng >=0 && $ng <=255)
$namegreen = $ng;
else $namegreen=255;
if ($nb != "" && $nb >=0 && $nb <=255)
$nameblue = $nb;
else $nameblue=255;
if ($ns != "" && $ns >=1 && $ns <=5)
$namesize = $ns;
else $namesize=3;
if ($nx != "" && $nx >=0 && $nx <=350)
$namex = $nx;
else $namex=10;
if ($ny != "" && $ny >=0 && $ny <=19)
$namey = $ny;
else $namey=3;
$name_colour = imagecolorallocate($my_img, $namered, $namegreen, $nameblue);
imagestring($my_img, $namesize, $namex, $namey, $username, $name_colour);
}
if (!$nu)
{
if ($ur != "" && $ur >=0 && $ur <=255)
$upred = $ur;
else $upred=0;
if ($ug != "" && $ug >=0 && $ug <=255)
$upgreen = $ug;
else $upgreen=255;
if ($ub != "" && $ub >=0 && $ub <=255)
$upblue = $ub;
else $upblue=0;
if ($us != "" && $us >=1 && $us <=5)
$upsize = $us;
else $upsize=3;
if ($ux != "" && $ux >=0 && $ux <=350)
$upx = $ux;
else $upx=100;
if ($uy != "" && $uy >=0 && $uy <=19)
$upy = $uy;
else $upy=3;
$up_colour = imagecolorallocate($my_img, $upred, $upgreen, $upblue);
imagestring($my_img, $upsize, $upx, $upy, $uploaded, $up_colour);
}
if (!$nd)
{
if ($dr != "" && $dr >=0 && $dr <=255)
$downred = $dr;
else $downred=255;
if ($dg != "" && $dg >=0 && $dg <=255)
$downgreen = $dg;
else $downgreen=0;
if ($dg != "" && $db >=0 && $db <=255)
$downblue = $db;
else $downblue=0;
if ($ds != "" && $ds >=1 && $ds <=5)
$downsize = $ds;
else $downsize=3;
if ($dx != "" && $dx >=0 && $dx <=350)
$downx = $dx;
else $downx=180;
if ($dy != "" && $dy >=0 && $dy <=19)
$downy = $dy;
else $downy=3;
$down_colour = imagecolorallocate($my_img, $downred, $downgreen, $downblue);
imagestring($my_img, $downsize, $downx, $downy, $downloaded, $down_colour);
}
imagesavealpha($my_img, true);
$Cache->cache_value('userbar_'.$_SERVER['REQUEST_URI'], $my_img, 300);
}
header("Content-type: image/png");
imagepng($my_img);
imagedestroy($my_img);
?>
+72
View File
@@ -0,0 +1,72 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
parked();
if (get_user_class() < $staffmem_class)
permissiondenied();
if (!empty($_POST['setdealt'])) {
$res = sql_query ("SELECT id FROM cheaters WHERE dealtwith=0 AND id IN (" . implode(", ", $_POST[delcheater]) . ")");
while ($arr = mysql_fetch_assoc($res))
sql_query ("UPDATE cheaters SET dealtwith=1, dealtby = $CURUSER[id] WHERE id = $arr[id]") or sqlerr();
$Cache->delete_value('staff_new_cheater_count');
}
elseif (!empty($_POST['delete'])) {
$res = sql_query ("SELECT id FROM cheaters WHERE id IN (" . implode(", ", $_POST[delcheater]) . ")");
while ($arr = mysql_fetch_assoc($res))
sql_query ("DELETE from cheaters WHERE id = $arr[id]") or sqlerr();
$Cache->delete_value('staff_new_cheater_count');
}
$count = get_row_count("cheaters");
if (!$count){
stderr($lang_cheaterbox['std_oho'], $lang_cheaterbox['std_no_suspect_detected']);
}
$perpage = 10;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "cheaterbox.php?");
stdhead($lang_cheaterbox['head_cheaterbox']);
?>
<style type="text/css">
table.cheaterbox td
{
text-align: center;
}
</style>
<?php
begin_main_frame();
print("<h1 align=center>".$lang_cheaterbox['text_cheaterbox']."</h1>");
print("<table class=cheaterbox border=1 cellspacing=0 cellpadding=5 align=center>\n");
print("<tr><td class=colhead><nobr>".$lang_cheaterbox['col_added']."</nobr></td><td class=colhead>".$lang_cheaterbox['col_suspect']."</td><td class=colhead><nobr>".$lang_cheaterbox['col_hit']."</nobr></td><td class=colhead>".$lang_cheaterbox['col_torrent']."</td><td class=colhead>".$lang_cheaterbox['col_ul']."</td><td class=colhead>".$lang_cheaterbox['col_dl']."</td><td class=colhead><nobr>".$lang_cheaterbox['col_ann_time']."</nobr></td><td class=colhead><nobr>".$lang_cheaterbox['col_seeders']."</nobr></td><td class=colhead><nobr>".$lang_cheaterbox['col_leechers']."</nobr></td><td class=colhead>".$lang_cheaterbox['col_comment']."</td><td class=colhead><nobr>".$lang_cheaterbox['col_dealt_with']."</nobr></td><td class=colhead><nobr>".$lang_cheaterbox['col_action']."</nobr></td></tr>");
print("<form method=post action=cheaterbox.php>");
$cheatersres = sql_query("SELECT * FROM cheaters ORDER BY dealtwith ASC, id DESC $limit");
while ($row = mysql_fetch_array($cheatersres))
{
$upspeed = ($row['uploaded'] > 0 ? $row['uploaded'] / $row['anctime'] : 0);
$lespeed = ($row['downloaded'] > 0 ? $row['downloaded'] / $row['anctime'] : 0);
$torrentres = sql_query("SELECT name FROM torrents WHERE id=".sqlesc($row['torrentid']));
$torrentrow = mysql_fetch_array($torrentres);
if ($torrentrow)
$torrent = "<a href=details.php?id=".$row['torrentid'].">".htmlspecialchars($torrentrow['name'])."</a>";
else $torrent = $lang_cheaterbox['text_torrent_does_not_exist'];
if ($row['dealtwith'])
$dealtwith = "<font color=green>".$lang_cheaterbox['text_yes']."</font> - " . get_username($row['dealtby']);
else
$dealtwith = "<font color=red>".$lang_cheaterbox['text_no']."</font>";
print("<tr><td class=rowfollow>".gettime($row['added'])."</td><td class=rowfollow>" . get_username($row['userid']) . "</td><td class=rowfollow>" . $row['hit'] . "</td><td class=rowfollow>" . $torrent . "</td><td class=rowfollow>".mksize($row['uploaded']).($upspeed ? " @ ".mksize($upspeed)."/s" : "")."</td><td class=rowfollow>".mksize($row['downloaded']).($lespeed ? " @ ".mksize($lespeed)."/s" : "")."</td><td class=rowfollow>".$row['anctime']." sec"."</td><td class=rowfollow>".$row['seeders']."</td><td class=rowfollow>".$row['leechers']."</td><td class=rowfollow>".htmlspecialchars($row['comment'])."</td><td class=rowfollow>".$dealtwith."</td><td class=rowfollow><input type=\"checkbox\" name=\"delcheater[]\" value=\"" . $row[id] . "\" /></td></tr>\n");
}
?>
<tr><td class="colhead" colspan="12" style="text-align: right"><input type="submit" name="setdealt" value="<?php echo $lang_cheaterbox['submit_set_dealt']?>" /><input type="submit" name="delete" value="<?php echo $lang_cheaterbox['submit_delete']?>" /></td></tr>
</form>
<?php
print("</table>");
print($pagerbottom);
end_main_frame();
stdfoot();
?>
+111
View File
@@ -0,0 +1,111 @@
<?php
// mod_cheat for torrentbits based tracker
// Copy this file to the same dir as the rest of the tracker stuff...
$top = 100; // Only look at the top xxx most likely...
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_MODERATOR) stderr("Error", "Permission denied.");
stdhead("Cheaters");
begin_frame('Cheaters');
$page = @$_GET['page'];
//$perpage = 100; // currently ignored
$class = @$_GET['c'];
if (!is_valid_user_class($class-2)) $class = '';
$ratio = @$_GET['r'];
if (!is_valid_id($ratio) && $ratio>=1 && $ratio<=7) $ratio = '';
echo '<center><form method="get" action="'.$_SERVER["PHP_SELF"].'">';
begin_table();
echo '<tr><th colspan="4">Important</th></tr><tr><td colspan="4" class="left">';
echo 'Although the word <b>cheat</b> is used here, it should be kept in mind that this<br />';
echo 'is statistical analysis - "There are lies, damm lies, and statistics!"<br />';
echo 'The value for cheating can and will change quite drastically depending on what<br />';
echo 'is happening, so you should always take into account other factors before<br />';
echo 'issueing a warning.<br />';
echo 'Somebody might get quite a high cheat value, but never cheat in their life - simply<br />';
echo 'from bad luck in when the client updates the tracker - but that will drop again in<br />';
echo 'the future. A true cheater will stay consistantly high...';
echo '</td></tr>';
echo '<tr><th>Class:</th>';
echo '<td><select name="c"><option value="1">(any)</option>';
for ($i = 2; ;++$i)
{
if ($c = get_user_class_name($i-2)) echo '<option value="'.$i.'"'.($class == $i? ' selected' : '').">&lt;= $c</option>\n";
else break;
}
echo '</select></td>';
echo '<th>Ratio:</th>';
echo '<td><select name="r"><option value="1"'.($ratio == 1?' selected' : '').'>(any)</option>';
echo '<option value="2"'.($ratio == 2?' selected' : '').'>&gt;= 1.000</option>';
echo '<option value="3"'.($ratio == 3?' selected' : '').'>&gt;= 2.000</option>';
echo '<option value="4"'.($ratio == 4?' selected' : '').'>&gt;= 3.000</option>';
echo '<option value="5"'.($ratio == 5?' selected' : '').'>&gt;= 4.000</option>';
echo '<option value="6"'.($ratio == 6?' selected' : '').'>&gt;= 5.000</option>';
echo '</select></td>';
echo '</tr><tr><td colspan="4"><input name="submit" type="submit"></td></tr>';
end_table();
echo '</form>';
$query = 'WHERE enabled = 1 AND downloaded > 0 AND uploaded > 0';
//' AND cheat >= '.$min
if ($class>2) $query .= ' AND class < '.($class - 1);
if ($ratio>1) $query .= ' AND (uploaded / downloaded) > '.($ratio - 1);
$res = sql_query("SELECT COUNT(*),MIN(cheat),MAX(cheat) FROM users $query") or sqlerr();
$arr = mysql_fetch_row($res);
$top = MIN($top, $arr[0]);
$min = $arr[1];
$max = $arr[2];
$pages = ceil($top / 20);
if ($page < 1) $page = 1;
elseif ($page > $pages) $page = $pages;
list($pagertop, $pagerbottom, $limit) = pager(20, $top, "cheaters.php?");
echo $pagertop;
begin_table();
print("<tr><th class=\"left\">User name</th><th>Registered</th><th>Uploaded</th><th>Downloaded</th><th>Ratio</th><th>Cheat Value</th><th>Cheat Spread</th></tr>\n");
$res = sql_query("SELECT * FROM users $query ORDER BY cheat DESC $limit") or sqlerr();
while ($arr = mysql_fetch_assoc($res))
{
if ($arr['added'] == "0000-00-00 00:00:00") $joindate = 'N/A';
else $joindate = get_elapsed_time(strtotime($arr['added'])).' ago';
$age = date('U') - date('U',strtotime($arr['added']));
if ($arr["downloaded"] > 0)
{
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";
} else {
if ($arr["uploaded"] > 0) $ratio = "Inf.";
else $ratio = "---";
}
if ($arr['added'] == '0000-00-00 00:00:00') $arr['added'] = '-';
echo '<tr><th class="left"><a href="userdetails.php?id='.$arr['id'].'"><b>'.$arr['username'].'</b></a></th>';
echo '<td>'.$joindate.'</td>';
echo '<td class="right">'.mksize($arr['uploaded']).' @ '.mksize($arr['uploaded'] / $age).'ps</td>';
echo '<td class="right">'.mksize($arr['downloaded']).' @ '.mksize($arr['downloaded'] / $age).'ps</td>';
echo '<td>'.$ratio.'</td>';
echo '<td>'.$arr['cheat'].'</td>';
echo '<td class="right">'.ceil(($arr['cheat'] - $min) / max(1, ($max - $min)) * 100).'%</td></tr>'."\n";
}
end_table();
echo $pagerbottom;
end_frame();
stdfoot();
?>
+62
View File
@@ -0,0 +1,62 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
parked();
$id = intval($_GET["id"] ?? 0);
int_check($id,true);
function bark($msg)
{
global $lang_checkuser;
stdhead();
stdmsg($lang_checkuser['std_error'], $msg);
stdfoot();
exit;
}
$r = @sql_query("SELECT * FROM users WHERE status = 'pending' AND id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$user = mysql_fetch_array($r) or bark($lang_checkuser['std_no_user_id']);
if (get_user_class() < UC_MODERATOR) {
if ($user[invited_by] != $CURUSER[id])
bark($lang_checkuser['std_no_permission']);
}
if ($user["gender"] == "Male") $gender = "<img src=pic/male.png alt='Male' style='margin-left: 4pt'>";
elseif ($user["gender"] == "Female") $gender = "<img src=pic/female.png alt='Female' style='margin-left: 4pt'>";
elseif ($user["gender"] == "N/A") $gender = "<img src=pic/na.gif alt='N/A' style='margin-left: 4pt'>";
if ($user[added] == "0000-00-00 00:00:00")
$joindate = 'N/A';
else
$joindate = "$user[added] (" . get_elapsed_time(strtotime($user["added"])) . " ago)";
$res = sql_query("SELECT name,flagpic FROM countries WHERE id=$user[country] LIMIT 1") or sqlerr();
if (mysql_num_rows($res) == 1)
{
$arr = mysql_fetch_assoc($res);
$country = "<td class=embedded><img src=pic/flag/$arr[flagpic] alt=\"$arr[name]\" style='margin-left: 8pt'></td>";
}
stdhead($lang_checkuser['head_detail_for'] . $user["username"]);
$enabled = $user["enabled"] == 'yes';
print("<p><table class=main border=0 cellspacing=0 cellpadding=0>".
"<tr><td class=embedded><h1 style='margin:0px'>" . get_username($user['id'], true, false) . "</h1></td>$country</tr></table></p><br />\n");
if (!$enabled)
print($lang_checkuser['text_account_disabled']);
?>
<table width=737 border=1 cellspacing=0 cellpadding=5>
<tr><td class=rowhead width=1%><?php echo $lang_checkuser['row_join_date'] ?></td><td align=left width=99%><?php echo $joindate;?></td></tr>
<tr><td class=rowhead width=1%><?php echo $lang_checkuser['row_gender'] ?></td><td align=left width=99%><?php echo $gender;?></td></tr>
<tr><td class=rowhead width=1%><?php echo $lang_checkuser['row_email'] ?></td><td align=left width=99%><a href=mailto:<?php echo $user[email];?>><?php echo $user[email];?></a></td></tr>
<?php
if (get_user_class() >= UC_MODERATOR AND $user[ip] != '')
print ("<tr><td class=rowhead width=1%>".$lang_checkuser['row_ip']."</td><td align=left width=99%>$user[ip]</td></tr>");
print("<form method=post action=takeconfirm.php?id=".htmlspecialchars($id).">");
print("<input type=hidden name=email value=$user[email]>");
print("<tr><td class=rowhead width=1%><input type=\"checkbox\" name=\"conusr[]\" value=\"" . $id . "\" checked/></td>");
print("<td align=left width=99%><input type=submit style='height: 20px' value=\"".$lang_checkuser['submit_confirm_this_user'] ."\"></form></tr></td></table>");
stdfoot();
+33
View File
@@ -0,0 +1,33 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_MODERATOR)
stderr("Error", "Permission denied.");
$done = false;
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$cachename = $_POST["cachename"];
if ($cachename == "")
stderr("Error", "You must fill in cache name.");
if ($_POST['multilang'] == 'yes')
$Cache->delete_value($cachename, true);
else
$Cache->delete_value($cachename);
$done = true;
}
stdhead("Clear cache");
?>
<h1>Clear cache</h1>
<?php
if ($done)
print ("<p align=center><font class=striking>Cache cleared</font></p>");
?>
<form method=post action=clearcache.php>
<table border=1 cellspacing=0 cellpadding=5>
<tr><td class=rowhead>Cache name</td><td><input type=text name=cachename size=40></td></tr>
<tr><td class=rowhead>Multi languages</td><td><input type=checkbox name=multilang>Yes</td></tr>
<tr><td colspan=2 align=center><input type=submit value="Okay" class=btn></td></tr>
</table>
</form>
<?php stdfoot();
+176
View File
@@ -0,0 +1,176 @@
if(!window.JSFX)JSFX=new Object();
var LinkFadeInStep=10;
var LinkFadeOutStep=10;
var LinkEndColor="FF6600"
var LinkStartColor="FFFFFF";
var LinkFadeRunning=false;
document.onmouseover = theOnOver;
document.onmouseout = theOnOut;
if(document.captureEvents)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
function hex2dec(hex){return(parseInt(hex,16));}
function dec2hex(dec){return (dec < 16 ? "0" : "") + dec.toString(16);}
function getColor(start, end, percent)
{
var r1=hex2dec(start.slice(0,2));
var g1=hex2dec(start.slice(2,4));
var b1=hex2dec(start.slice(4,6));
var r2=hex2dec(end.slice(0,2));
var g2=hex2dec(end.slice(2,4));
var b2=hex2dec(end.slice(4,6));
var pc=percent/100;
var r=Math.floor(r1+(pc*(r2-r1)) + .5);
var g=Math.floor(g1+(pc*(g2-g1)) + .5);
var b=Math.floor(b1+(pc*(b2-b1)) + .5);
return("#" + dec2hex(r) + dec2hex(g) + dec2hex(b));
}
JSFX.getCurrentElementColor = function(el)
{
var result = LinkStartColor;
if (el.currentStyle)
result = (el.currentStyle.color);
else if (document.defaultView)
result = (document.defaultView.getComputedStyle(el,'').getPropertyValue('color'));
else if(el.style.color)
result = el.style.color;
if(result.charAt(0) == "#")
result = result.slice(1, 8);
else if(result.charAt(0) == "r")
{
var v1 = result.slice(result.indexOf("(")+1, result.indexOf(")") );
var v2 = v1.split(",");
result = (dec2hex(parseInt(v2[0])) + dec2hex(parseInt(v2[1])) + dec2hex(parseInt(v2[2])));
}
return result;
}
JSFX.findTagIE = function(el)
{
while (el && el.tagName != 'A')
el = el.parentElement;
return(el);
}
JSFX.findTagNS= function(el)
{
while (el && el.nodeName != 'A')
el = el.parentNode;
return(el);
}
function theOnOver(e)
{
var lnk;
if(window.event)
lnk=JSFX.findTagIE(event.srcElement);
else
lnk=JSFX.findTagNS(e.target);
if(lnk)
JSFX.linkFadeUp(lnk);
}
JSFX.linkFadeUp = function(lnk)
{
if(lnk.state == null)
{
lnk.state = "OFF";
lnk.index = 0;
lnk.startColor = JSFX.getCurrentElementColor(lnk);
lnk.endColor = LinkEndColor;
}
if(lnk.state == "OFF")
{
lnk.state = "FADE_UP";
JSFX.startLinkFader();
}
else if( lnk.state == "FADE_UP_DOWN"
|| lnk.state == "FADE_DOWN")
{
lnk.state = "FADE_UP";
}
}
function theOnOut(e)
{
var lnk;
if(window.event)
lnk=JSFX.findTagIE(event.srcElement);
else
lnk=JSFX.findTagNS(e.target);
if(lnk)
JSFX.linkFadeDown(lnk);
}
JSFX.linkFadeDown = function(lnk)
{
if(lnk.state=="ON")
{
lnk.state="FADE_DOWN";
JSFX.startLinkFader();
}
else if(lnk.state == "FADE_UP")
{
lnk.state="FADE_UP_DOWN";
}
}
JSFX.startLinkFader = function()
{
if(!LinkFadeRunning)
JSFX.LinkFadeAnimation();
}
JSFX.LinkFadeAnimation = function()
{
LinkFadeRunning = false;
for(i=0 ; i<document.links.length ; i++)
{
var lnk = document.links[i];
if(lnk.state)
{
if(lnk.state == "FADE_UP")
{
lnk.index+=LinkFadeInStep;
if(lnk.index > 100)
lnk.index = 100;
lnk.style.color=getColor(lnk.startColor, lnk.endColor, lnk.index);
if(lnk.index == 100)
lnk.state="ON";
else
LinkFadeRunning = true;
}
else if(lnk.state == "FADE_UP_DOWN")
{
lnk.index+=LinkFadeOutStep;
if(lnk.index>100)
lnk.index = 100;
lnk.style.color=getColor(lnk.startColor, lnk.endColor, lnk.index);
if(lnk.index == 100)
lnk.state="FADE_DOWN";
LinkFadeRunning = true;
}
else if(lnk.state == "FADE_DOWN")
{
lnk.index-=LinkFadeOutStep;
if(lnk.index<0)
lnk.index = 0;
lnk.style.color=getColor(lnk.startColor, lnk.endColor, lnk.index);
if(lnk.index == 0)
lnk.state="OFF";
else
LinkFadeRunning = true;
}
}
}
if(LinkFadeRunning)
setTimeout("JSFX.LinkFadeAnimation()", 40);
}
+305
View File
@@ -0,0 +1,305 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
require(get_langfile_path("",true));
$action = htmlspecialchars($_GET["action"]);
$sub = htmlspecialchars($_GET["sub"] ?? '');
$type = htmlspecialchars($_GET["type"]);
loggedinorreturn();
parked();
function check_comment_type($type)
{
if($type != "torrent" && $type != "request" && $type != "offer")
stderr($lang_comment['std_error'],$lang_comment['std_error']);
}
check_comment_type($type);
if ($action == "add")
{
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
// Anti Flood Code
// This code ensures that a member can only send one comment per minute.
if (get_user_class() < $commanage_class) {
if (strtotime($CURUSER['last_comment']) > (TIMENOW - 10))
{
$secs = 10 - (TIMENOW - strtotime($CURUSER['last_comment']));
stderr($lang_comment['std_error'],$lang_comment['std_comment_flooding_denied']."$secs".$lang_comment['std_before_posting_another']);
}
}
$parent_id = intval($_POST["pid"] ?? 0);
int_check($parent_id,true);
if($type == "torrent")
$res = sql_query("SELECT name, owner FROM torrents WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
else if($type == "offer")
$res = sql_query("SELECT name, userid as owner FROM offers WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
else if($type == "request")
$res = sql_query("SELECT requests.request as name, userid as owner FROM requests WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_array($res);
if (!$arr)
stderr($lang_comment['std_error'], $lang_comment['std_no_torrent_id']);
$text = trim($_POST["body"]);
if (!$text)
stderr($lang_comment['std_error'], $lang_comment['std_comment_body_empty']);
if($type == "torrent"){
sql_query("INSERT INTO comments (user, torrent, added, text, ori_text) VALUES (" .$CURUSER["id"] . ",$parent_id, '" . date("Y-m-d H:i:s") . "', " . sqlesc($text) . "," . sqlesc($text) . ")");
$Cache->delete_value('torrent_'.$parent_id.'_last_comment_content');
}
elseif($type == "offer"){
sql_query("INSERT INTO comments (user, offer, added, text, ori_text) VALUES (" .$CURUSER["id"] . ",$parent_id, '" . date("Y-m-d H:i:s") . "', " . sqlesc($text) . "," . sqlesc($text) . ")");
$Cache->delete_value('offer_'.$parent_id.'_last_comment_content');
}
elseif($type == "request")
sql_query("INSERT INTO comments (user, request, added, text, ori_text) VALUES (" .$CURUSER["id"] . ",$parent_id, '" . date("Y-m-d H:i:s") . "', " . sqlesc($text) . "," . sqlesc($text) . ")");
$newid = mysql_insert_id();
if($type == "torrent")
sql_query("UPDATE torrents SET comments = comments + 1 WHERE id = $parent_id");
else if($type == "offer")
sql_query("UPDATE offers SET comments = comments + 1 WHERE id = $parent_id");
else if($type == "request")
sql_query("UPDATE requests SET comments = comments + 1 WHERE id = $parent_id");
$ras = sql_query("SELECT commentpm FROM users WHERE id = $arr[owner]") or sqlerr(__FILE__,__LINE__);
$arg = mysql_fetch_array($ras);
if($arg["commentpm"] == 'yes' && $CURUSER['id'] != $arr["owner"])
{
$added = sqlesc(date("Y-m-d H:i:s"));
$subject = sqlesc($lang_comment_target[get_user_lang($arr["owner"])]['msg_new_comment']);
if($type == "torrent")
$notifs = sqlesc($lang_comment_target[get_user_lang($arr["owner"])]['msg_torrent_receive_comment'] . " [url=" . get_protocol_prefix() . "$BASEURL/details.php?id=$parent_id] " . $arr['name'] . "[/url].");
if($type == "offer")
$notifs = sqlesc($lang_comment_target[get_user_lang($arr["owner"])]['msg_torrent_receive_comment'] . " [url=" . get_protocol_prefix() . "$BASEURL/offers.php?id=$parent_id&off_details=1] " . $arr['name'] . "[/url].");
if($type == "request")
$notifs = sqlesc($lang_comment_target[get_user_lang($arr["owner"])]['msg_torrent_receive_comment'] . " [url=" . get_protocol_prefix() . "$BASEURL/viewrequests.php?id=$parent_id&req_details=1] " . $arr['name'] . "[/url].");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, " . $arr['owner'] . ", $subject, $notifs, $added)") or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('user_'.$arr['owner'].'_unread_message_count');
$Cache->delete_value('user_'.$arr['owner'].'_inbox_count');
}
KPS("+",$addcomment_bonus,$CURUSER["id"]);
// Update Last comment sent...
sql_query("UPDATE users SET last_comment = NOW() WHERE id = ".sqlesc($CURUSER['id'])) or sqlerr(__FILE__, __LINE__);
if($type == "torrent")
header("Refresh: 0; url=details.php?id=$parent_id#$newid");
else if($type == "offer")
header("Refresh: 0; url=offers.php?id=$parent_id&off_details=1#$newid");
else if($type == "request")
header("Refresh: 0; url=viewrequests.php?id=$parent_id&req_details=1#$newid");
die;
}
$parent_id = intval($_GET["pid"] ?? 0);
int_check($parent_id,true);
if($sub == "quote")
{
$commentid = intval($_GET["cid"] ?? 0);
int_check($commentid,true);
$res2 = sql_query("SELECT comments.text, users.username FROM comments JOIN users ON comments.user = users.id WHERE comments.id=$commentid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res2) != 1)
stderr($lang_forums['std_error'], $lang_forums['std_no_comment_id']);
$arr2 = mysql_fetch_assoc($res2);
}
if($type == "torrent"){
$res = sql_query("SELECT name, owner FROM torrents WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
$url="details.php?id=$parent_id";
}
else if($type == "offer"){
$res = sql_query("SELECT name, userid as owner FROM offers WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
$url="offers.php?id=$parent_id&off_details=1";
}
else if($type == "request"){
$res = sql_query("SELECT requests.request as name, userid as owner FROM requests WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
$url="viewrequests.php?id=$parent_id&req_details=1";
}
$arr = mysql_fetch_array($res);
if (!$arr)
stderr($lang_comment['std_error'], $lang_comment['std_no_torrent_id']);
stdhead($lang_comment['head_add_comment_to']. $arr["name"]);
begin_main_frame();
$title = $lang_comment['text_add_comment_to']."<a href=$url>". htmlspecialchars($arr["name"]) . "</a>";
print("<form id=compose method=post name=\"compose\" action=\"comment.php?action=add&type=$type\">\n");
print("<input type=\"hidden\" name=\"pid\" value=\"$parent_id\"/>\n");
begin_compose($title, ($sub == "quote" ? "quote" : "reply"), ($sub == "quote" ? htmlspecialchars("[quote=".htmlspecialchars($arr2["username"])."]".unesc($arr2["text"])."[/quote]") : ""), false);
end_compose();
print("</form>");
end_main_frame();
stdfoot();
die;
}
elseif ($action == "edit")
{
$commentid = intval($_GET["cid"] ?? 0);
int_check($commentid,true);
if($type == "torrent")
$res = sql_query("SELECT c.*, t.name, t.id AS parent_id FROM comments AS c JOIN torrents AS t ON c.torrent = t.id WHERE c.id=$commentid") or sqlerr(__FILE__,__LINE__);
else if($type == "offer")
$res = sql_query("SELECT c.*, o.name, o.id AS parent_id FROM comments AS c JOIN offers AS o ON c.offer = o.id WHERE c.id=$commentid") or sqlerr(__FILE__,__LINE__);
else if($type == "request")
$res = sql_query("SELECT c.*, r.request as name, r.id AS parent_id FROM comments AS c JOIN requests AS r ON c.request = r.id WHERE c.id=$commentid") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_array($res);
if (!$arr)
stderr($lang_comment['std_error'], $lang_comment['std_invalid_id']);
if ($arr["user"] != $CURUSER["id"] && get_user_class() < $commanage_class)
stderr($lang_comment['std_error'], $lang_comment['std_permission_denied']);
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$text = $_POST["body"];
$returnto = htmlspecialchars($_POST["returnto"]) ? $_POST["returnto"] : htmlspecialchars($_SERVER["HTTP_REFERER"]);
if ($text == "")
stderr($lang_comment['std_error'], $lang_comment['std_comment_body_empty']);
$text = sqlesc($text);
$editdate = sqlesc(date("Y-m-d H:i:s"));
sql_query("UPDATE comments SET text=$text, editdate=$editdate, editedby=$CURUSER[id] WHERE id=".sqlesc($commentid)) or sqlerr(__FILE__, __LINE__);
if($type == "torrent")
$Cache->delete_value('torrent_'.$arr['parent_id'].'_last_comment_content');
elseif ($type == "offer")
$Cache->delete_value('offer_'.$arr['parent_id'].'_last_comment_content');
header("Location: $returnto");
die;
}
$parent_id = $arr["parent_id"];
if($type == "torrent")
$url="details.php?id=$parent_id";
else if($type == "offer")
$url="offers.php?id=$parent_id&off_details=1";
else if($type == "request")
$url="viewrequests.php?id=$parent_id&req_details=1";
stdhead($lang_comment['head_edit_comment_to']."\"". $arr["name"] . "\"");
begin_main_frame();
$title = $lang_comment['head_edit_comment_to']."<a href=$url>". htmlspecialchars($arr["name"]) . "</a>";
print("<form id=compose method=post name=\"compose\" action=\"comment.php?action=edit&cid=$commentid&type=$type\">\n");
print("<input type=\"hidden\" name=\"returnto\" value=\"" . htmlspecialchars($_SERVER["HTTP_REFERER"]) . "\" />\n");
begin_compose($title, "edit", htmlspecialchars(unesc($arr["text"])), false);
end_compose();
print("</form>");
end_main_frame();
stdfoot();
die;
}
elseif ($action == "delete")
{
if (get_user_class() < $commanage_class)
stderr($lang_comment['std_error'], $lang_comment['std_permission_denied']);
$commentid = intval($_GET["cid"] ?? 0);
$sure = $_GET["sure"];
int_check($commentid,true);
if (!$sure)
{
$referer = $_SERVER["HTTP_REFERER"];
stderr($lang_comment['std_delete_comment'], $lang_comment['std_delete_comment_note'] ."<a href=comment.php?action=delete&cid=$commentid&sure=1&type=$type" .($referer ? "&returnto=" . rawurlencode($referer) : "") . $lang_comment['std_here_if_sure'],false);
}
else
int_check($sure,true);
if($type == "torrent")
$res = sql_query("SELECT torrent as pid,user FROM comments WHERE id=$commentid") or sqlerr(__FILE__,__LINE__);
else if($type == "offer")
$res = sql_query("SELECT offer as pid,user FROM comments WHERE id=$commentid") or sqlerr(__FILE__,__LINE__);
else if($type == "request")
$res = sql_query("SELECT request as pid,user FROM comments WHERE id=$commentid") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_array($res);
if ($arr)
{
$parent_id = $arr["pid"];
$userpostid = $arr["user"];
}
else
stderr($lang_comment['std_error'], $lang_comment['std_invalid_id']);
sql_query("DELETE FROM comments WHERE id=$commentid") or sqlerr(__FILE__,__LINE__);
if ($type == "torrent")
$Cache->delete_value('torrent_'.$arr['pid'].'_last_comment_content');
elseif ($type == "offer")
$Cache->delete_value('offer_'.$arr['pid'].'_last_comment_content');
if ($parent_id && mysql_affected_rows() > 0)
{
if($type == "torrent")
sql_query("UPDATE torrents SET comments = comments - 1 WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
else if($type == "offer")
sql_query("UPDATE offers SET comments = comments - 1 WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
else if($type == "request")
sql_query("UPDATE requests SET comments = comments - 1 WHERE id = $parent_id") or sqlerr(__FILE__,__LINE__);
}
KPS("-",$addcomment_bonus,$userpostid);
$returnto = $_GET["returnto"] ? $_GET["returnto"] : htmlspecialchars($_SERVER["HTTP_REFERER"]);
header("Location: $returnto");
die;
}
elseif ($action == "vieworiginal")
{
if (get_user_class() < $commanage_class)
stderr($lang_comment['std_error'], $lang_comment['std_permission_denied']);
$commentid = intval($_GET["cid"] ?? 0);
int_check($commentid,true);
if($type == "torrent")
$res = sql_query("SELECT c.*, t.name FROM comments AS c JOIN torrents AS t ON c.torrent = t.id WHERE c.id=$commentid") or sqlerr(__FILE__,__LINE__);
else if($type == "offer")
$res = sql_query("SELECT c.*, o.name FROM comments AS c JOIN offers AS o ON c.offer = o.id WHERE c.id=$commentid") or sqlerr(__FILE__,__LINE__);
else if($type == "request")
$res = sql_query("SELECT c.*, r.request as name FROM comments AS c JOIN requests AS r ON c.request = r.id WHERE c.id=$commentid") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_array($res);
if (!$arr)
stderr($lang_comment['std_error'], $lang_comment['std_invalid_id']);
stdhead($lang_comment['head_original_comment']);
print("<h1>".$lang_comment['text_original_content_of_comment']."#$commentid</h1>");
print("<table width=\"737\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\">");
print("<tr><td class=\"text\">\n");
echo format_comment($arr["ori_text"]);
print("</td></tr></table>\n");
$returnto = htmlspecialchars($_SERVER["HTTP_REFERER"]);
if ($returnto)
print("<p><font size=\"small\">(<a href=\"".$returnto."\">".$lang_comment['text_back']."</a>)</font></p>\n");
stdfoot();
die;
}
else
stderr($lang_comment['std_error'], $lang_comment['std_unknown_action']);
die;
?>
+374
View File
@@ -0,0 +1,374 @@
function postvalid(form){
$('qr').disabled = true;
return true;
}
function dropmenu(obj){
$(obj.id + 'list').style.display = $(obj.id + 'list').style.display == 'none' ? '' : 'none';
}
function confirm_delete(id, note, addon)
{
if(confirm(note))
{
self.location.href='?action=del'+(addon ? '&'+addon : '')+'&id='+id;
}
}
//viewfilelist.js
function viewfilelist(torrentid)
{
var result=ajax.gets('viewfilelist.php?id='+torrentid);
document.getElementById("showfl").style.display = 'none';
document.getElementById("hidefl").style.display = 'block';
showlist(result);
}
function showlist(filelist)
{
document.getElementById("filelist").innerHTML=filelist;
}
function hidefilelist()
{
document.getElementById("hidefl").style.display = 'none';
document.getElementById("showfl").style.display = 'block';
document.getElementById("filelist").innerHTML="";
}
//viewpeerlist.js
function viewpeerlist(torrentid)
{
var list=ajax.gets('viewpeerlist.php?id='+torrentid);
document.getElementById("showpeer").style.display = 'none';
document.getElementById("hidepeer").style.display = 'block';
document.getElementById("peercount").style.display = 'none';
document.getElementById("peerlist").innerHTML=list;
}
function hidepeerlist()
{
document.getElementById("hidepeer").style.display = 'none';
document.getElementById("peerlist").innerHTML="";
document.getElementById("showpeer").style.display = 'block';
document.getElementById("peercount").style.display = 'block';
}
// smileit.js
function SmileIT(smile,form,text){
document.forms[form].elements[text].value = document.forms[form].elements[text].value+" "+smile+" ";
document.forms[form].elements[text].focus();
}
// saythanks.js
function saythanks(torrentid)
{
var list=ajax.post('thanks.php','','id='+torrentid);
document.getElementById("thanksbutton").innerHTML = document.getElementById("thanksadded").innerHTML;
document.getElementById("nothanks").innerHTML = "";
document.getElementById("addcuruser").innerHTML = document.getElementById("curuser").innerHTML;
}
// preview.js
function preview(obj) {
var poststr = encodeURIComponent( document.getElementById("body").value );
var result=ajax.posts('preview.php','body='+poststr);
document.getElementById("previewouter").innerHTML=result;
document.getElementById("previewouter").style.display = 'block';
document.getElementById("editorouter").style.display = 'none';
document.getElementById("unpreviewbutton").style.display = 'block';
document.getElementById("previewbutton").style.display = 'none';
}
function unpreview(obj){
document.getElementById("previewouter").style.display = 'none';
document.getElementById("editorouter").style.display = 'block';
document.getElementById("unpreviewbutton").style.display = 'none';
document.getElementById("previewbutton").style.display = 'block';
}
// java_klappe.js
function klappe(id)
{
var klappText = document.getElementById('k' + id);
var klappBild = document.getElementById('pic' + id);
if (klappText.style.display == 'none') {
klappText.style.display = 'block';
// klappBild.src = 'pic/blank.gif';
}
else {
klappText.style.display = 'none';
// klappBild.src = 'pic/blank.gif';
}
}
function klappe_news(id)
{
var klappText = document.getElementById('k' + id);
var klappBild = document.getElementById('pic' + id);
if (klappText.style.display == 'none') {
klappText.style.display = '';
klappBild.className = 'minus';
}
else {
klappText.style.display = 'none';
klappBild.className = 'plus';
}
}
function klappe_ext(id)
{
var klappText = document.getElementById('k' + id);
var klappBild = document.getElementById('pic' + id);
var klappPoster = document.getElementById('poster' + id);
if (klappText.style.display == 'none') {
klappText.style.display = 'block';
klappPoster.style.display = 'block';
klappBild.className = 'minus';
}
else {
klappText.style.display = 'none';
klappPoster.style.display = 'none';
klappBild.className = 'plus';
}
}
// disableother.js
function disableother(select,target)
{
if (document.getElementById(select).value == 0)
document.getElementById(target).disabled = false;
else {
document.getElementById(target).disabled = true;
document.getElementById(select).disabled = false;
}
}
function disableother2(oricat,newcat)
{
if (document.getElementById("movecheck").checked == true){
document.getElementById(oricat).disabled = true;
document.getElementById(newcat).disabled = false;
}
else {
document.getElementById(oricat).disabled = false;
document.getElementById(newcat).disabled = true;
}
}
// ctrlenter.js
var submitted = false;
function ctrlenter(event,formname,submitname){
if (submitted == false){
var keynum;
if (event.keyCode){
keynum = event.keyCode;
}
else if (event.which){
keynum = event.which;
}
if (event.ctrlKey && keynum == 13){
submitted = true;
document.getElementById(formname).submit();
}
}
}
function gotothepage(page){
var url=window.location.href;
var end=url.lastIndexOf("page");
url = url.replace(/#[0-9]+/g,"");
if (end == -1){
if (url.lastIndexOf("?") == -1)
window.location.href=url+"?page="+page;
else
window.location.href=url+"&page="+page;
}
else{
url = url.replace(/page=.+/g,"");
window.location.href=url+"page="+page;
}
}
function changepage(event){
var gotopage;
var keynum;
var altkey;
if (navigator.userAgent.toLowerCase().indexOf('presto') != -1)
altkey = event.shiftKey;
else altkey = event.altKey;
if (event.keyCode){
keynum = event.keyCode;
}
else if (event.which){
keynum = event.which;
}
if(altkey && keynum==33){
if(currentpage<=0) return;
gotopage=currentpage-1;
gotothepage(gotopage);
}
else if (altkey && keynum == 34){
if(currentpage>=maxpage) return;
gotopage=currentpage+1;
gotothepage(gotopage);
}
}
if(window.document.addEventListener){
window.addEventListener("keydown",changepage,false);
}
else{
window.attachEvent("onkeydown",changepage,false);
}
// bookmark.js
function bookmark(torrentid,counter)
{
var result=ajax.gets('bookmark.php?torrentid='+torrentid);
bmicon(result,counter);
}
function bmicon(status,counter)
{
if (status=="added")
document.getElementById("bookmark"+counter).innerHTML="<img class=\"bookmark\" src=\"pic/trans.gif\" alt=\"Bookmarked\" />";
else if (status=="deleted")
document.getElementById("bookmark"+counter).innerHTML="<img class=\"delbookmark\" src=\"pic/trans.gif\" src=\"pic/trans.gif\" alt=\"Unbookmarked\" />";
}
// check.js
var checkflag = "false";
function check(field,checkall_name,uncheckall_name) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return uncheckall_name; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return checkall_name; }
}
// in torrents.php
var form='searchbox';
function SetChecked(chkName,ctrlName,checkall_name,uncheckall_name,start,count) {
dml=document.forms[form];
len = dml.elements.length;
var begin;
var end;
if (start == -1){
begin = 0;
end = len;
}
else{
begin = start;
end = start + count;
}
var check_state;
for( i=0 ; i<len ; i++) {
if(dml.elements[i].name==ctrlName)
{
if(dml.elements[i].value == checkall_name)
{
dml.elements[i].value = uncheckall_name;
check_state=1;
}
else
{
dml.elements[i].value = checkall_name;
check_state=0;
}
}
}
for( i=begin ; i<end ; i++) {
if (dml.elements[i].name.indexOf(chkName) != -1) {
dml.elements[i].checked=check_state;
}
}
}
// funvote.js
function funvote(funid,yourvote)
{
var result=ajax.gets('fun.php?action=vote&id='+funid+"&yourvote="+yourvote);
voteaccept(yourvote);
}
function voteaccept(yourvote)
{
if (yourvote=="fun" || yourvote=="dull"){
document.getElementById("funvote").style.display = 'none';
document.getElementById("voteaccept").style.display = 'block';
}
}
// in upload.php
function getname()
{
var filename = document.getElementById("torrent").value;
var filename = filename.toString();
var lowcase = filename.toLowerCase();
var start = lowcase.lastIndexOf("\\"); //for Google Chrome on windows
if (start == -1){
start = lowcase.lastIndexOf("\/"); // for Google Chrome on linux
if (start == -1)
start == 0;
else start = start + 1;
}
else start = start + 1;
var end = lowcase.lastIndexOf("torrent");
var noext = filename.substring(start,end-1);
noext = noext.replace(/H\.264/ig,"H_264");
noext = noext.replace(/5\.1/g,"5_1");
noext = noext.replace(/2\.1/g,"2_1");
noext = noext.replace(/\./g," ");
noext = noext.replace(/H_264/g,"H.264");
noext = noext.replace(/5_1/g,"5.1");
noext = noext.replace(/2_1/g,"2.1");
document.getElementById("name").value=noext;
}
// in userdetails.php
function getusertorrentlistajax(userid, type, blockid)
{
if (document.getElementById(blockid).innerHTML==""){
var infoblock=ajax.gets('getusertorrentlistajax.php?userid='+userid+'&type='+type);
document.getElementById(blockid).innerHTML=infoblock;
}
return true;
}
// in functions.php
function get_ext_info_ajax(blockid,url,cache,type)
{
if (document.getElementById(blockid).innerHTML==""){
var infoblock=ajax.gets('getextinfoajax.php?url='+url+'&cache='+cache+'&type='+type);
document.getElementById(blockid).innerHTML=infoblock;
}
return true;
}
// in userdetails.php
function enabledel(msg){
document.deluser.submit.disabled=document.deluser.submit.checked;
alert (msg);
}
function disabledel(){
document.deluser.submit.disabled=!document.deluser.submit.checked;
}
// in mybonus.php
function customgift()
{
if (document.getElementById("giftselect").value == '0'){
document.getElementById("giftselect").disabled = true;
document.getElementById("giftcustom").disabled = false;
}
}
+47
View File
@@ -0,0 +1,47 @@
<?php
require_once("../include/bittorrent.php");
header("Content-Type: text/html; charset=utf-8");
$id = (int) $_GET["id"];
$confirm_md5 = $_GET["secret"];
if (!$id)
httperr();
dbconn();
$res = sql_query("SELECT passhash, secret, editsecret, status FROM users WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_assoc($res);
if (!$row)
httperr();
if ($row["status"] != "pending") {
header("Refresh: 0; url=ok.php?type=confirmed");
exit();
}
$confirm_sec = hash_pad($row["secret"]);
if ($confirm_md5 != md5($confirm_sec))
httperr();
sql_query("UPDATE users SET status='confirmed', editsecret='' WHERE id=".sqlesc($id)." AND status='pending'") or sqlerr(__FILE__, __LINE__);
if (!mysql_affected_rows())
httperr();
if ($securelogin == "yes")
{
$securelogin_indentity_cookie = true;
$passh = md5($row["passhash"].$_SERVER["REMOTE_ADDR"]);
}
else // when it's op, default is not use secure login
{
$securelogin_indentity_cookie = false;
$passh = md5($row["passhash"]);
}
logincookie($id, $passh,1,0x7fffffff,$securelogin_indentity_cookie);
//sessioncookie($row["id"], $passh,false);
header("Refresh: 0; url=ok.php?type=confirm");
?>
+123
View File
@@ -0,0 +1,123 @@
<?php
require "../include/bittorrent.php";
dbconn();
failedloginscheck ("Re-send",true);
$langid = intval($_GET['sitelanguage'] ?? 0);
if ($langid)
{
$lang_folder = validlang($langid);
if(get_langfolder_cookie() != $lang_folder)
{
set_langfolder_cookie($lang_folder);
header("Location: " . $_SERVER['PHP_SELF']);
}
}
require_once(get_langfile_path("", false, $CURLANGDIR));
function bark($msg) {
global $lang_confirm_resend;
stdhead();
stdmsg($lang_confirm_resend['resend_confirmation_email_failed'], $msg);
stdfoot();
exit;
}
if ($verification == "admin")
bark($lang_confirm_resend['std_need_admin_verification']);
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if ($iv == "yes")
check_code ($_POST['imagehash'], $_POST['imagestring'],"confirm_resend.php",true);
$email = unesc(htmlspecialchars(trim($_POST["email"])));
$wantpassword = unesc(htmlspecialchars(trim($_POST["wantpassword"])));
$passagain = unesc(htmlspecialchars(trim($_POST["passagain"])));
$email = safe_email($email);
if (empty($wantpassword) || empty($passagain) || empty($email))
bark($lang_confirm_resend['std_fields_blank']);
if (!check_email($email))
failedlogins($lang_confirm_resend['std_invalid_email_address'],true);
$res = sql_query("SELECT * FROM users WHERE email=" . sqlesc($email) . " LIMIT 1") or sqlerr(__FILE__, __LINE__);
$arr = mysql_fetch_assoc($res) or failedlogins($lang_confirm_resend['std_email_not_found'],true);
if($arr["status"] != "pending") failedlogins($lang_confirm_resend['std_user_already_confirm'],true);
if ($wantpassword != $passagain)
bark($lang_confirm_resend['std_passwords_unmatched']);
if (strlen($wantpassword) < 6)
bark($lang_confirm_resend['std_password_too_short']);
if (strlen($wantpassword) > 40)
bark($lang_confirm_resend['std_password_too_long']);
if ($wantpassword == $wantusername)
bark($lang_confirm_resend['std_password_equals_username']);
$secret = mksecret();
$wantpasshash = md5($secret . $wantpassword . $secret);
$editsecret = ($verification == 'admin' ? '' : $secret);
sql_query("UPDATE users SET passhash=" .sqlesc($wantpasshash) . ",secret=" . sqlesc($secret) . ",editsecret=" . sqlesc($editsecret) . " WHERE id=" . sqlesc($arr["id"])) or sqlerr(__FILE__, __LINE__);
if (!mysql_affected_rows())
stderr($lang_confirm_resend['std_error'], $lang_confirm_resend['std_database_error']);
$psecret = md5($editsecret);
$ip = getip() ;
$usern = $arr["username"];
$id = $arr["id"];
$title = $SITENAME.$lang_confirm_resend['mail_title'];
$body = <<<EOD
{$lang_confirm_resend['mail_one']}$usern{$lang_confirm_resend['mail_two']}($email){$lang_confirm_resend['mail_three']}$ip{$lang_confirm_resend['mail_four']}
<b><a href="javascript:void(null)" onclick="window.open('http://$BASEURL/confirm.php?id=$id&secret=$psecret')">
{$lang_confirm_resend['mail_this_link']} </a></b><br />
http://$BASEURL/confirm.php?id=$id&secret=$psecret
{$lang_confirm_resend['mail_four_1']}
<b><a href="javascript:void(null)" onclick="window.open('http://$BASEURL/confirm_resend.php')">{$lang_confirm_resend['mail_here']}</a></b><br />
http://$BASEURL/confirm_resend.php
<br />
{$lang_confirm_resend['mail_five']}
EOD;
sent_mail($email,$SITENAME,$SITEEMAIL,change_email_encode(get_langfolder_cookie(), $title),change_email_encode(get_langfolder_cookie(),$body),"signup",false,false,'',get_email_encode(get_langfolder_cookie()));
header("Location: " . get_protocol_prefix() . "$BASEURL/ok.php?type=signup&email=" . rawurlencode($email));
}
else
{
stdhead();
$s = "<select name=\"sitelanguage\" onchange='submit()'>\n";
$langs = langlist("site_lang");
foreach ($langs as $row)
{
if ($row["site_lang_folder"] == get_langfolder_cookie()) $se = " selected=\"selected\""; else $se = "";
$s .= "<option value=\"". $row["id"]."\" " . $se. ">" . htmlspecialchars($row["lang_name"]) . "</option>\n";
}
$s .= "\n</select>";
?>
<form method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<?php
print("<div align=\"right\">".$lang_confirm_resend['text_select_lang']. $s . "</div>");
?>
</form>
<?php echo $lang_confirm_resend['text_resend_confirmation_mail_note']?>
<p><?php echo $lang_confirm_resend['text_you_have'] ?><b><?php echo remaining ();?></b><?php echo $lang_confirm_resend['text_remaining_tries'] ?></p>
<form method="post" action="confirm_resend.php">
<table border="1" cellspacing="0" cellpadding="10">
<tr><td class="rowhead nowrap"><?php echo $lang_confirm_resend['row_registered_email'] ?></td>
<td class="rowfollow"><input type="text" style="width: 200px" name="email" /></td></tr>
<tr><td class="rowhead nowrap"><?php echo $lang_confirm_resend['row_new_password'] ?></td><td align="left"><input type="password" style="width: 200px" name="wantpassword" /><br />
<font class="small"><?php echo $lang_confirm_resend['text_password_note'] ?></font></td></tr>
<tr><td class="rowhead nowrap"><?php echo $lang_confirm_resend['row_enter_password_again'] ?></td><td align="left"><input type="password" style="width: 200px" name="passagain" /></td></tr>
<?php
show_image_code();
?>
<tr><td class="toolbox" colspan="2" align="center"><input type="submit" class="btn" value="<?php echo $lang_confirm_resend['submit_send_it'] ?>" /></td></tr>
</table></form>
<?php
stdfoot();
}
+35
View File
@@ -0,0 +1,35 @@
<?php
require_once("../include/bittorrent.php");
if (!preg_match(':^/(\d{1,10})/([\w]{32})/(.+)$:', $_SERVER["PATH_INFO"], $matches))
httperr();
$id = intval($matches[1] ?? 0);
$md5 = $matches[2];
$email = urldecode($matches[3]);
//print($email);
//die();
if (!$id)
httperr();
dbconn();
$res = sql_query("SELECT editsecret FROM users WHERE id = $id");
$row = mysql_fetch_array($res);
if (!$row)
httperr();
$sec = hash_pad($row["editsecret"]);
if (preg_match('/^ *$/s', $sec))
httperr();
if ($md5 != md5($sec . $email . $sec))
httperr();
sql_query("UPDATE users SET editsecret='', email=" . sqlesc($email) . " WHERE id=$id AND editsecret=" . sqlesc($row["editsecret"]));
if (!mysql_affected_rows())
httperr();
header("Refresh: 0; url=" . get_protocol_prefix() . "$BASEURL/usercp.php?action=security&type=saved");
?>
+16
View File
@@ -0,0 +1,16 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
stdhead($lang_contactstaff['head_contact_staff'], false);
begin_main_frame();
print("<form id=compose method=post name=\"compose\" action=takecontact.php>");
if (isset($_GET["returnto"]) && $_GET["returnto"] || $_SERVER["HTTP_REFERER"])
print("<input type=hidden name=returnto value=\"".(htmlspecialchars($_GET["returnto"] ?? '') ? htmlspecialchars($_GET["returnto"] ?? '') : htmlspecialchars($_SERVER["HTTP_REFERER"] ?? ''))."\">");
begin_compose($lang_contactstaff['text_message_to_staff'], "new");
end_compose();
print("</form>");
end_main_frame();
stdfoot();
+13
View File
@@ -0,0 +1,13 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
if ($useCronTriggerCleanUp) {
$return = autoclean();
if ($return) {
echo $return."\n";
} else {
echo "Clean-up not triggered.\n";
}
} else {
echo "Forbidden. Clean-up is set to be browser-triggered.\n";
}
+86
View File
@@ -0,0 +1,86 @@
if (navigator.appName=="Netscape") {
document.write("<style type='text/css'>body {overflow-y:scroll;}<\/style>");
}
var userAgent = navigator.userAgent.toLowerCase();
var is_ie = (userAgent.indexOf('msie') != -1) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}
function Scale(image, max_width, max_height) {
var tempimage = new Image();
tempimage.src = image.src;
var tempwidth = tempimage.width;
var tempheight = tempimage.height;
if (tempwidth > max_width) {
image.height = tempheight = Math.round(((max_width)/tempwidth) * tempheight);
image.width = tempwidth = max_width;
}
if (max_height != 0 && tempheight > max_height)
{
image.width = Math.round(((max_height)/tempheight) * tempwidth);
image.height = max_height;
}
}
function check_avatar(image, langfolder){
var tempimage = new Image();
tempimage.src = image.src;
var displayheight = image.height;
var tempwidth = tempimage.width;
var tempheight = tempimage.height;
if (tempwidth > 250 || tempheight > 250 || displayheight > 250) {
image.src='pic/forum_pic/'+langfolder+'/avatartoobig.png';
}
}
function Preview(image) {
if (!is_ie || is_ie >= 7){
$('lightbox').innerHTML = "<a onclick=\"Return();\"><img src=\"" + image.src + "\" /></a>";
$('curtain').style.display = "block";
$('lightbox').style.display = "block";
}
else{
window.open(image.src);
}
}
function Previewurl(url) {
if (!is_ie || is_ie >= 7){
$('lightbox').innerHTML = "<a onclick=\"Return();\"><img src=\"" + url + "\" /></a>";
$('curtain').style.display = "block";
$('lightbox').style.display = "block";
}
else{
window.open(url);
}
}
function findPosition( oElement ) {
if( typeof( oElement.offsetParent ) != 'undefined' ) {
for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
posX += oElement.offsetLeft;
posY += oElement.offsetTop;
}
return [ posX, posY ];
} else {
return [ oElement.x, oElement.y ];
}
}
function Return() {
$('lightbox').style.display = "none";
$('curtain').style.display = "none";
$('lightbox').innerHTML = "";
}
+37
View File
@@ -0,0 +1,37 @@
<?php
require "../include/bittorrent.php";
dbconn();
if (get_user_class() < UC_ADMINISTRATOR)
stderr("Error", "Permission denied.");
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$userid = trim($_POST["userid"]);
if (!$userid)
stderr("Error", "Please fill out the form correctly.");
$res = sql_query("SELECT * FROM users WHERE id=" . sqlesc($userid)) or sqlerr();
if (mysql_num_rows($res) != 1)
stderr("Error", "Bad user id or password. Please verify that all entered information is correct.");
$arr = mysql_fetch_assoc($res);
$id = $arr['id'];
$name = $arr['username'];
$res = sql_query("DELETE FROM users WHERE id=$id") or sqlerr();
if (mysql_affected_rows() != 1)
stderr("Error", "Unable to delete the account.");
stderr("Success", "The account <b>".htmlspecialchars($name)."</b> was deleted.",false);
}
stdhead("Delete account");
?>
<h1>Delete account</h1>
<table border=1 cellspacing=0 cellpadding=5>
<form method=post action=delacctadmin.php>
<tr><td class=rowhead>User name</td><td><input size=40 name=userid></td></tr>
<tr><td colspan=2><input type=submit class=btn value='Delete'></td></tr>
</form>
</table>
<?php
stdfoot();
+87
View File
@@ -0,0 +1,87 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
require_once(get_langfile_path("",true));
loggedinorreturn();
function bark($msg) {
global $lang_delete;
stdhead();
stdmsg($lang_delete['std_delete_failed'], $msg);
stdfoot();
exit;
}
if (!mkglobal("id"))
bark($lang_delete['std_missing_form_date']);
$id = intval($id ?? 0);
if (!$id)
die();
$res = sql_query("SELECT name,owner,seeders,anonymous FROM torrents WHERE id = ".sqlesc($id));
$row = mysql_fetch_array($res);
if (!$row)
die();
if ($CURUSER["id"] != $row["owner"] && get_user_class() < $torrentmanage_class)
bark($lang_delete['std_not_owner']);
$rt = intval($_POST["reasontype"] ?? 0);
if (!is_int($rt) || $rt < 1 || $rt > 5)
bark($lang_delete['std_invalid_reason']."$rt.");
$r = $_POST["r"];
$reason = $_POST["reason"];
if ($rt == 1)
$reasonstr = "Dead: 0 seeders, 0 leechers = 0 peers total";
elseif ($rt == 2)
$reasonstr = "Dupe" . ($reason[0] ? (": " . trim($reason[0])) : "!");
elseif ($rt == 3)
$reasonstr = "Nuked" . ($reason[1] ? (": " . trim($reason[1])) : "!");
elseif ($rt == 4)
{
if (!$reason[2])
bark($lang_delete['std_describe_violated_rule']);
$reasonstr = $SITENAME." rules broken: " . trim($reason[2]);
}
else
{
if (!$reason[3])
bark($lang_delete['std_enter_reason']);
$reasonstr = trim($reason[3]);
}
deletetorrent($id);
if ($row['anonymous'] == 'yes' && $CURUSER["id"] == $row["owner"]) {
write_log("Torrent $id ($row[name]) was deleted by its anonymous uploader ($reasonstr)",'normal');
} else {
write_log("Torrent $id ($row[name]) was deleted by $CURUSER[username] ($reasonstr)",'normal');
}
//===remove karma
KPS("-",$uploadtorrent_bonus,$row["owner"]);
//Send pm to torrent uploader
if ($CURUSER["id"] != $row["owner"]){
$dt = sqlesc(date("Y-m-d H:i:s"));
$subject = sqlesc($lang_delete_target[get_user_lang($row["owner"])]['msg_torrent_deleted']);
$msg = sqlesc($lang_delete_target[get_user_lang($row["owner"])]['msg_the_torrent_you_uploaded'].$row['name'].$lang_delete_target[get_user_lang($row["owner"])]['msg_was_deleted_by']."[url=userdetails.php?id=".$CURUSER['id']."]".$CURUSER['username']."[/url]".$lang_delete_target[get_user_lang($row["owner"])]['msg_reason_is'].$reasonstr);
sql_query("INSERT INTO messages (sender, receiver, subject, added, msg) VALUES(0, {$row['owner']}, $subject, $dt, $msg)") or sqlerr(__FILE__, __LINE__);
}
stdhead($lang_delete['head_torrent_deleted']);
if (isset($_POST["returnto"]))
$ret = "<a href=\"" . htmlspecialchars($_POST["returnto"]) . "\">".$lang_delete['text_go_back']."</a>";
else
$ret = "<a href=\"index.php\">".$lang_delete['text_back_to_index']."</a>";
?>
<h1><?php echo $lang_delete['text_torrent_deleted'] ?></h1>
<p><?php echo $ret ?></p>
<?php
stdfoot();
+44
View File
@@ -0,0 +1,44 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
require_once(get_langfile_path());
if (get_user_class() < UC_SYSOP)
permissiondenied();
$shownotice=false;
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if ($_POST['sure'])
{
$res=sql_query("DELETE FROM users WHERE enabled='no'");
$deletecount=mysql_affected_rows();
$shownotice=true;
}
}
stdhead($lang_deletedisabled['head_delete_diasabled']);
begin_main_frame();
?>
<h1 align="center"><?php echo $lang_deletedisabled['text_delete_diasabled']?></h1>
<?php
if ($shownotice)
{
?>
<div style="text-align: center;"><?php echo $deletecount.$lang_deletedisabled['text_users_are_disabled']?></div>
<?php
}
else
{
?>
<div style="text-align: center;"><?php echo $lang_deletedisabled['text_delete_disabled_note']?></div>
<div style="text-align: center; margin-top: 10px;">
<form method="post" action="?">
<input type="hidden" name="sure" value="1" />
<input type="submit" value="<?php echo $lang_deletedisabled['submit_delete_all_disabled_users']?>" />
</form>
</div>
<?php
}
end_main_frame();
stdfoot();
?>
+43
View File
@@ -0,0 +1,43 @@
<?php
require "../include/bittorrent.php";
$id = $_GET["id"];
if (!is_numeric($id) || $id < 1 || floor($id) != $id)
die("Invalid ID");
$type = $_GET["type"];
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
if ($type == 'in')
{
// make sure message is in CURUSER's Inbox
$res = sql_query("SELECT receiver, location FROM messages WHERE id=" . sqlesc($id)) or die("barf");
$arr = mysql_fetch_array($res) or die($lang_deletemessage['std_bad_message_id']);
if ($arr["receiver"] != $CURUSER["id"])
die($lang_deletemessage['std_not_suggested']);
if ($arr["location"] == 'in')
sql_query("DELETE FROM messages WHERE id=" . sqlesc($id)) or die('delete failed (error code 1).. this should never happen, contact an admin.');
else if ($arr["location"] == 'both')
sql_query("UPDATE messages SET location = 'out' WHERE id=" . sqlesc($id)) or die('delete failed (error code 2).. this should never happen, contact an admin.');
else
die($lang_deletemessage['std_not_in_inbox']);
}
elseif ($type == 'out')
{
// make sure message is in CURUSER's Sentbox
$res = sql_query("SELECT sender, location FROM messages WHERE id=" . sqlesc($id)) or die("barf");
$arr = mysql_fetch_array($res) or die($lang_deletemessage['std_bad_message_id']);
if ($arr["sender"] != $CURUSER["id"])
die($lang_deletemessage['std_not_suggested']);
if ($arr["location"] == 'out')
sql_query("DELETE FROM messages WHERE id=" . sqlesc($id)) or die('delete failed (error code 3).. this should never happen, contact an admin.');
else if ($arr["location"] == 'both')
sql_query("UPDATE messages SET location = 'in' WHERE id=" . sqlesc($id)) or die('delete failed (error code 4).. this should never happen, contact an admin.');
else
die($lang_deletemessage['std_not_in_sentbox']);
}
else
die($lang_deletemessage['std_unknown_pm_type']);
header("Location: " . get_protocol_prefix() . "$BASEURL/messages.php".($type == 'out'?"?out=1":""));
?>
+588
View File
@@ -0,0 +1,588 @@
<?php
ob_start(); //Do not delete this line
require_once("../include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
if ($showextinfo['imdb'] == 'yes')
require_once("imdb/imdb.class.php");
loggedinorreturn();
$id = intval($_GET["id"] ?? 0);
int_check($id);
if (!isset($id) || !$id)
die();
$res = sql_query("SELECT torrents.cache_stamp, torrents.sp_state, torrents.url, torrents.small_descr, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, nfo, LENGTH(torrents.nfo) AS nfosz, torrents.last_action, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, torrents.anonymous, categories.name AS cat_name, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name, teams.name AS team_name, audiocodecs.name AS audiocodec_name FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN sources ON torrents.source = sources.id LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id LEFT JOIN teams ON torrents.team = teams.id LEFT JOIN audiocodecs ON torrents.audiocodec = audiocodecs.id WHERE torrents.id = $id LIMIT 1")
or sqlerr();
$row = mysql_fetch_array($res);
if (get_user_class() >= $torrentmanage_class || $CURUSER["id"] == $row["owner"])
$owned = 1;
else $owned = 0;
if (!$row)
stderr($lang_details['std_error'], $lang_details['std_no_torrent_id']);
elseif ($row['banned'] == 'yes' && get_user_class() < $seebanned_class)
permissiondenied();
else {
if (!empty($_GET["hit"])) {
sql_query("UPDATE torrents SET views = views + 1 WHERE id = $id");
}
if (!isset($_GET["cmtpage"])) {
stdhead($lang_details['head_details_for_torrent']. "\"" . $row["name"] . "\"");
if (!empty($_GET["uploaded"]))
{
print("<h1 align=\"center\">".$lang_details['text_successfully_uploaded']."</h1>");
print("<p>".$lang_details['text_redownload_torrent_note']."</p>");
header("refresh: 1; url=download.php?id=$id");
//header("refresh: 1; url=getimdb.php?id=$id&type=1");
}
elseif (!empty($_GET["edited"])) {
print("<h1 align=\"center\">".$lang_details['text_successfully_edited']."</h1>");
if (isset($_GET["returnto"]))
print("<p><b>".$lang_details['text_go_back'] . "<a href=\"".htmlspecialchars($_GET["returnto"])."\">" . $lang_details['text_whence_you_came']."</a></b></p>");
}
$sp_torrent = get_torrent_promotion_append($row['sp_state'],'word');
$s=htmlspecialchars($row["name"]).($sp_torrent ? "&nbsp;&nbsp;&nbsp;".$sp_torrent : "");
print("<h1 align=\"center\" id=\"top\">".$s."</h1>\n");
print("<table width=\"940\" cellspacing=\"0\" cellpadding=\"5\">\n");
$url = "edit.php?id=" . $row["id"];
if (isset($_GET["returnto"])) {
$url .= "&returnto=" . rawurlencode($_GET["returnto"]);
}
$editlink = "a title=\"".$lang_details['title_edit_torrent']."\" href=\"$url\"";
// ------------- start upped by block ------------------//
if($row['anonymous'] == 'yes') {
if (get_user_class() < $viewanonymous_class)
$uprow = "<i>".$lang_details['text_anonymous']."</i>";
else
$uprow = "<i>".$lang_details['text_anonymous']."</i> (" . get_username($row['owner'], false, true, true, false, false, true) . ")";
}
else {
$uprow = (isset($row['owner']) ? get_username($row['owner'], false, true, true, false, false, true) : "<i>".$lang_details['text_unknown']."</i>");
}
if ($CURUSER["id"] == $row["owner"])
$CURUSER["downloadpos"] = "yes";
if ($CURUSER["downloadpos"] != "no")
{
print("<tr><td class=\"rowhead\" width=\"13%\">".$lang_details['row_download']."</td><td class=\"rowfollow\" width=\"87%\" align=\"left\">");
if ($CURUSER['timetype'] != 'timealive')
$uploadtime = $lang_details['text_at'].$row['added'];
else $uploadtime = $lang_details['text_blank'].gettime($row['added'],true,false);
print("<a class=\"index\" href=\"download.php?id=$id\">" . htmlspecialchars($torrentnameprefix ."." .$row["save_as"]) . ".torrent</a>&nbsp;&nbsp;<a id=\"bookmark0\" href=\"javascript: bookmark(".$row['id'].",0);\">".get_torrent_bookmark_state($CURUSER['id'], $row['id'], false)."</a>&nbsp;&nbsp;&nbsp;".$lang_details['row_upped_by']."&nbsp;".$uprow.$uploadtime);
print("</td></tr>");
}
else
tr($lang_details['row_download'], $lang_details['text_downloading_not_allowed']);
if ($smalldescription_main == 'yes')
tr($lang_details['row_small_description'],htmlspecialchars(trim($row["small_descr"])),true);
$size_info = "<b>".$lang_details['text_size']."</b>" . mksize($row["size"]);
$type_info = "&nbsp;&nbsp;&nbsp;<b>".$lang_details['row_type'].":</b>&nbsp;".$row["cat_name"];
$source_info = $medium_info = $codec_info = $audiocodec_info = $standard_info = $processing_info = $team_info = '';
if (isset($row["source_name"]))
$source_info = "&nbsp;&nbsp;&nbsp;<b>".$lang_details['text_source']."&nbsp;</b>".$row['source_name'];
if (isset($row["medium_name"]))
$medium_info = "&nbsp;&nbsp;&nbsp;<b>".$lang_details['text_medium']."&nbsp;</b>".$row['medium_name'];
if (isset($row["codec_name"]))
$codec_info = "&nbsp;&nbsp;&nbsp;<b>".$lang_details['text_codec']."&nbsp;</b>".$row['codec_name'];
if (isset($row["standard_name"]))
$standard_info = "&nbsp;&nbsp;&nbsp;<b>".$lang_details['text_stardard']."&nbsp;</b>".$row['standard_name'];
if (isset($row["processing_name"]))
$processing_info = "&nbsp;&nbsp;&nbsp;<b>".$lang_details['text_processing']."&nbsp;</b>".$row['processing_name'];
if (isset($row["team_name"]))
$team_info = "&nbsp;&nbsp;&nbsp;<b>".$lang_details['text_team']."&nbsp;</b>".$row['team_name'];
if (isset($row["audiocodec_name"]))
$audiocodec_info = "&nbsp;&nbsp;&nbsp;<b>".$lang_details['text_audio_codec']."&nbsp;</b>".$row['audiocodec_name'];
tr($lang_details['row_basic_info'], $size_info.$type_info.$source_info . $medium_info. $codec_info . $audiocodec_info. $standard_info . $processing_info . $team_info, 1);
if ($CURUSER["downloadpos"] != "no")
$download = "<a title=\"".$lang_details['title_download_torrent']."\" href=\"download.php?id=".$id."\"><img class=\"dt_download\" src=\"pic/trans.gif\" alt=\"download\" />&nbsp;<b><font class=\"small\">".$lang_details['text_download_torrent']."</font></b></a>&nbsp;|&nbsp;";
else $download = "";
tr($lang_details['row_action'], $download. ($owned == 1 ? "<$editlink><img class=\"dt_edit\" src=\"pic/trans.gif\" alt=\"edit\" />&nbsp;<b><font class=\"small\">".$lang_details['text_edit_torrent'] . "</font></b></a>&nbsp;|&nbsp;" : ""). (get_user_class() >= $askreseed_class && $row['seeders'] == 0 ? "<a title=\"".$lang_details['title_ask_for_reseed']."\" href=\"takereseed.php?reseedid=$id\"><img class=\"dt_reseed\" src=\"pic/trans.gif\" alt=\"reseed\">&nbsp;<b><font class=\"small\">".$lang_details['text_ask_for_reseed'] ."</font></b></a>&nbsp;|&nbsp;" : "") . "<a title=\"".$lang_details['title_report_torrent']."\" href=\"report.php?torrent=$id\"><img class=\"dt_report\" src=\"pic/trans.gif\" alt=\"report\" />&nbsp;<b><font class=\"small\">".$lang_details['text_report_torrent']."</font></b></a>", 1);
// ---------------- start subtitle block -------------------//
$r = sql_query("SELECT subs.*, language.flagpic, language.lang_name FROM subs LEFT JOIN language ON subs.lang_id=language.id WHERE torrent_id = " . sqlesc($row["id"]). " ORDER BY subs.lang_id ASC") or sqlerr(__FILE__, __LINE__);
print("<tr><td class=\"rowhead\" valign=\"top\">".$lang_details['row_subtitles']."</td>");
print("<td class=\"rowfollow\" align=\"left\" valign=\"top\">");
print("<table border=\"0\" cellspacing=\"0\">");
if (mysql_num_rows($r) > 0)
{
while($a = mysql_fetch_assoc($r))
{
$lang = "<tr><td class=\"embedded\"><img border=\"0\" src=\"pic/flag/". $a["flagpic"] . "\" alt=\"" . $a["lang_name"] . "\" title=\"" . $a["lang_name"] . "\" style=\"padding-bottom: 4px\" /></td>";
$lang .= "<td class=\"embedded\">&nbsp;&nbsp;<a href=\"downloadsubs.php?torrentid=".$a[torrent_id]."&subid=".$a[id]."\"><u>". $a["title"]. "</u></a>".(get_user_class() >= $submanage_class || (get_user_class() >= $delownsub_class && $a["uppedby"] == $CURUSER["id"]) ? " <font class=\"small\"><a href=\"subtitles.php?delete=".$a[id]."\">[".$lang_details['text_delete']."</a>]</font>" : "")."</td><td class=\"embedded\">&nbsp;&nbsp;".($a["anonymous"] == 'yes' ? $lang_details['text_anonymous'] . (get_user_class() >= $viewanonymous_class ? get_username($a['uppedby'],false,true,true,false,true) : "") : get_username($a['uppedby']))."</td></tr>";
print($lang);
}
}
else
print("<tr><td class=\"embedded\">".$lang_details['text_no_subtitles']."</td></tr>");
print("</table>");
print("<table border=\"0\" cellspacing=\"0\"><tr>");
if($CURUSER['id']==$row['owner'] || get_user_class() >= $uploadsub_class)
{
print("<td class=\"embedded\"><form method=\"post\" action=\"subtitles.php\"><input type=\"hidden\" name=\"torrent_name\" value=\"" . $row["name"]. "\" /><input type=\"hidden\" name=\"detail_torrent_id\" value=\"" . $row["id"]. "\" /><input type=\"hidden\" name=\"in_detail\" value=\"in_detail\" /><input type=\"submit\" value=\"".$lang_details['submit_upload_subtitles']."\" /></form></td>");
}
$moviename = "";
$imdb_id = parse_imdb_id($row["url"]);
if ($imdb_id && $showextinfo['imdb'] == 'yes')
{
$thenumbers = $imdb_id;
if (!$moviename = $Cache->get_value('imdb_id_'.$thenumbers.'_movie_name')){
$movie = new imdb ($thenumbers);
$target = array('Title');
switch ($movie->cachestate($target)){
case "1":{
$moviename = $movie->title (); break;
$Cache->cache_value('imdb_id_'.$thenumbers.'_movie_name', $moviename, 1296000);
}
default: break;
}
}
}
print("<td class=\"embedded\"><form method=\"get\" action=\"http://shooter.cn/sub/\" target=\"_blank\"><input type=\"text\" name=\"searchword\" id=\"keyword\" style=\"width: 250px\" value=\"".$moviename."\" /><input type=\"submit\" value=\"".$lang_details['submit_search_at_shooter']."\" /></form></td><td class=\"embedded\"><form method=\"get\" action=\"http://www.opensubtitles.org/en/search2/\" target=\"_blank\"><input type=\"hidden\" id=\"moviename\" name=\"MovieName\" /><input type=\"hidden\" name=\"action\" value=\"search\" /><input type=\"hidden\" name=\"SubLanguageID\" value=\"all\" /><input onclick=\"document.getElementById('moviename').value=document.getElementById('keyword').value;\" type=\"submit\" value=\"".$lang_details['submit_search_at_opensubtitles']."\" /></form></td>\n");
print("</tr></table>");
print("</td></tr>\n");
// ---------------- end subtitle block -------------------//
if ($CURUSER['showdescription'] != 'no' && !empty($row["descr"])){
$torrentdetailad=$Advertisement->get_ad('torrentdetail');
tr("<a href=\"javascript: klappe_news('descr')\"><span class=\"nowrap\"><img class=\"minus\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picdescr\" title=\"".($lang_details['title_show_or_hide'] ?? '')."\" /> ".$lang_details['row_description']."</span></a>", "<div id='kdescr'>".($Advertisement->enable_ad() && $torrentdetailad ? "<div align=\"left\" style=\"margin-bottom: 10px\" id=\"ad_torrentdetail\">".$torrentdetailad[0]."</div>" : "").format_comment($row["descr"])."</div>", 1);
}
if (get_user_class() >= $viewnfo_class && $CURUSER['shownfo'] != 'no' && $row["nfosz"] > 0){
if (!$nfo = $Cache->get_value('nfo_block_torrent_id_'.$id)){
$nfo = code($row["nfo"], $view == "magic");
$Cache->cache_value('nfo_block_torrent_id_'.$id, $nfo, 604800);
}
tr("<a href=\"javascript: klappe_news('nfo')\"><img class=\"plus\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picnfo\" title=\"".$lang_details['title_show_or_hide']."\" /> ".$lang_details['text_nfo']."</a><br /><a href=\"viewnfo.php?id=".$row[id]."\" class=\"sublink\">". $lang_details['text_view_nfo']. "</a>", "<div id='knfo' style=\"display: none;\"><pre style=\"font-size:10pt; font-family: 'Courier New', monospace;\">".$nfo."</pre></div>\n", 1);
}
if ($imdb_id && $showextinfo['imdb'] == 'yes' && $CURUSER['showimdb'] != 'no')
{
$thenumbers = $imdb_id;
$Cache->new_page('imdb_id_'.$thenumbers.'_large', 1296000, true);
if (!$Cache->get_page()){
$movie = new imdb ($thenumbers);
$movieid = $thenumbers;
$movie->setid ($movieid);
$target = array('Title', 'Credits', 'Plot');
switch ($movie->cachestate($target))
{
case "0" : //cache is not ready, try to
{
if($row['cache_stamp']==0 || ($row['cache_stamp'] != 0 && (time()-$row['cache_stamp']) > $auto_obj->timeout)) //not exist or timed out
tr($lang_details['text_imdb'] . $lang_details['row_info'] , $lang_details['text_imdb'] . $lang_details['text_not_ready']."<a href=\"retriver.php?id=". $id ."&amp;type=1&amp;siteid=1\">".$lang_details['text_here_to_retrieve'] . $lang_details['text_imdb'],1);
else
tr($lang_details['text_imdb'] . $lang_details['row_info'] , "<img src=\"pic/progressbar.gif\" alt=\"\" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $lang_details['text_someone_has_requested'] . $lang_details['text_imdb'] . " ".min(max(time()-$row['cache_stamp'],0),$auto_obj->timeout) . $lang_details['text_please_be_patient'],1);
break;
}
case "1" :
{
reset_cachetimestamp($row['id']);
$country = $movie->country ();
$director = $movie->director();
$creator = $movie->creator(); // For TV series
$write = $movie->writing();
$produce = $movie->producer();
$cast = $movie->cast();
// $plot = $movie->plot ();
$plot_outline = $movie->plotoutline();
$compose = $movie->composer();
$gen = $movie->genres();
//$comment = $movie->comment();
$similiar_movies = $movie->similiar_movies();
if (($photo_url = $movie->photo_localurl() ) != FALSE)
$smallth = "<img src=\"".$photo_url. "\" width=\"105\" onclick=\"Preview(this);\" alt=\"poster\" />";
else
$smallth = "<img src=\"pic/imdb_pic/nophoto.gif\" alt=\"no poster\" />";
$autodata = '<a href="https://www.imdb.com/title/tt'.$thenumbers.'">https://www.imdb.com/title/tt'.$thenumbers."</a><br /><strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_information']."</font><br />\n";
$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong><br />\n";
$autodata .= "<strong><font color=\"DarkRed\">". $lang_details['text_title']."</font></strong>" . "".$movie->title ()."<br />\n";
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_also_known_as']."</font></strong>";
$temp = "";
foreach ($movie->alsoknow() as $ak)
{
// $temp .= $ak["title"].$ak["year"]. ($ak["country"] != "" ? " (".$ak["country"].")" : "") . ($ak["comment"] != "" ? " (" . $ak["comment"] . ")" : "") . ", ";
$temp .= $ak["title"] . ", ";
}
$autodata .= rtrim(trim($temp), ",");
$runtimes = str_replace(" min",$lang_details['text_mins'], $movie->runtime_all());
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_year']."</font></strong>" . "".$movie->year ()."<br />\n";
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_runtime']."</font></strong>".$runtimes."<br />\n";
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_votes']."</font></strong>" . "".$movie->votes ()."<br />\n";
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_rating']."</font></strong>" . "".$movie->rating ()."<br />\n";
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_language']."</font></strong>" . "".$movie->language ()."<br />\n";
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_country']."</font></strong>";
$temp = "";
for ($i = 0; $i < count ($country); $i++)
{
$temp .="$country[$i], ";
}
$autodata .= rtrim(trim($temp), ",");
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_all_genres']."</font></strong>";
$temp = "";
for ($i = 0; $i < count($gen); $i++)
{
$temp .= "$gen[$i], ";
}
$autodata .= rtrim(trim($temp), ",");
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_tagline']."</font></strong>" . "".$movie->tagline ()."<br />\n";
if ($director){
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_director']."</font></strong>";
$temp = "";
for ($i = 0; $i < count ($director); $i++)
{
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$director[$i]["imdb"]."" ."\">" . $director[$i]["name"] . "</a>, ";
}
$autodata .= rtrim(trim($temp), ",");
}
elseif ($creator)
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_creator']."</font></strong>".$creator;
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_written_by']."</font></strong>";
$temp = "";
for ($i = 0; $i < count ($write); $i++)
{
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$write[$i]["imdb"]."" ."\">" . "".$write[$i]["name"]."" . "</a>, ";
}
$autodata .= rtrim(trim($temp), ",");
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_produced_by']."</font></strong>";
$temp = "";
for ($i = 0; $i < count ($produce); $i++)
{
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$produce[$i]["imdb"]."" ." \">" . "".$produce[$i]["name"]."" . "</a>, ";
}
$autodata .= rtrim(trim($temp), ",");
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_music']."</font></strong>";
$temp = "";
for ($i = 0; $i < count($compose); $i++)
{
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$compose[$i]["imdb"]."" ." \">" . "".$compose[$i]["name"]."" . "</a>, ";
}
$autodata .= rtrim(trim($temp), ",");
$autodata .= "<br /><br />\n\n<strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_plot_outline']."</font><br />\n";
$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong>";
// if(count($plot) == 0)
// {
// $autodata .= "<br />\n".$plot_outline;
// }
// else
// {
// for ($i = 0; $i < count ($plot); $i++)
// {
// $autodata .= "<br />\n<font color=\"DarkRed\">.</font> ";
// $autodata .= $plot[$i];
// }
// }
if (!empty($plot_outline)) {
$autodata .= "<br />\n".$plot_outline;
}
$autodata .= "<br /><br />\n\n<strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_cast']."</font><br />\n";
$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong><br />\n";
for ($i = 0; $i < count ($cast); $i++)
{
// if ($i > 9)
// {
// break;
// }
$autodata .= "<font color=\"DarkRed\">.</font> " . "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$cast[$i]["imdb"]."" ."\">" . $cast[$i]["name"] . "</a> " .$lang_details['text_as']."<strong><font color=\"DarkRed\">" . "".$cast[$i]["role"]."" . " </font></strong><br />\n";
}
/*$autodata .= "<br /><strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_may_also_like']."</font><br />\n";
$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong><br />\n";
$autodata .= "<table cellpadding=\"10\"><tr>";
if($similiar_movies)
{
$counter = 0;
foreach($similiar_movies as $similiar_movies_each)
{
$on_site = "";
$imdb_config_inst = new imdb_config();
if($imdb_id_new = parse_imdb_id($imdb_config_inst->imdbsite . $similiar_movies_each['Link']))
{
$similiar_res = sql_query("SELECT id FROM torrents WHERE url = " . sqlesc((int)$imdb_id_new) . " AND id != ".sqlesc($id)." ORDER BY RAND() LIMIT 1") or sqlerr(__FILE__, __LINE__);
while($similiar_arr = mysql_fetch_array($similiar_res)) {
$on_site = "<strong><a href=\"" .htmlspecialchars(get_protocol_prefix() . $BASEURL . "/details.php?id=" . $similiar_arr['id'] . "&hit=1")."\">" . $lang_details['text_local_link'] . "</a></strong>";
}
}
$autodata .= ($counter == 5 ? "</tr><tr>" : "" ) . "<td align=\"center\" style=\"border: 0px; padding-left: 20px; padding-right: 20px; padding-bottom: 10px\"><a href=\"" . $movie->protocol_prefix . $movie->imdbsite . $similiar_movies_each['Link'] . "\" title=\"\"><img style=\"border:0px;\" src=\"" . $similiar_movies_each['Local'] . "\" alt=\"" . $similiar_movies_each['Name'] . "\" /><br />" . $similiar_movies_each['Name'] . "</a><br />" . ($on_site != "" ? $on_site : "&nbsp;") . "</td>";
$counter++;
}
}
$autodata .= "</tr></table>";*/
//$autodata .= "<br />\n\n<strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
//$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_recommended_comment']."</font><br />\n";
//$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong>";
//$autodata .= "<br />".$comment;
$cache_time = $movie->getcachetime();
$Cache->add_whole_row();
print("<tr>");
print("<td class=\"rowhead\"><a href=\"javascript: klappe_ext('imdb')\"><span class=\"nowrap\"><img class=\"minus\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picimdb\" title=\"".($lang_details['title_show_or_hide'] ?? '')."\" /> ".$lang_details['text_imdb'] . $lang_details['row_info'] ."</span></a><div id=\"posterimdb\">". $smallth."</div></td>");
$Cache->end_whole_row();
$Cache->add_row();
$Cache->add_part();
print("<td class=\"rowfollow\" align=\"left\"><div id='kimdb'>".$autodata);
$Cache->end_part();
$Cache->add_part();
print($lang_details['text_information_updated_at'] . date("Y-m-d H:i:s", $cache_time) . $lang_details['text_might_be_outdated']."<a href=\"".htmlspecialchars("retriver.php?id=". $id ."&type=2&siteid=1")."\">".$lang_details['text_here_to_update']);
$Cache->end_part();
$Cache->end_row();
$Cache->add_whole_row();
print("</div></td></tr>");
$Cache->end_whole_row();
$Cache->cache_page();
echo $Cache->next_row();
$Cache->next_row();
echo $Cache->next_part();
if (get_user_class() >= $updateextinfo_class)
echo $Cache->next_part();
echo $Cache->next_row();
break;
}
case "2" :
{
tr($lang_details['text_imdb'] . $lang_details['row_info'] ,$lang_details['text_network_error'],1);
break;
}
case "3" :// not a valid imdb url
{
break;
}
}
}
else{
echo $Cache->next_row();
$Cache->next_row();
echo $Cache->next_part();
if (get_user_class() >= $updateextinfo_class){
echo $Cache->next_part();
}
echo $Cache->next_row();
}
}
if ($imdb_id)
{
$where_area = " url = " . sqlesc((int)$imdb_id) ." AND torrents.id != ".sqlesc($id);
$copies_res = sql_query("SELECT torrents.id, torrents.name, torrents.sp_state, torrents.size, torrents.added, torrents.seeders, torrents.leechers, categories.id AS catid, categories.name AS catname, categories.image AS catimage, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name FROM torrents LEFT JOIN categories ON torrents.category=categories.id LEFT JOIN sources ON torrents.source = sources.id LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id WHERE " . $where_area . " ORDER BY torrents.id DESC") or sqlerr(__FILE__, __LINE__);
$copies_count = mysql_num_rows($copies_res);
if($copies_count > 0)
{
$s = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n";
$s.="<tr><td class=\"colhead\" style=\"padding: 0px; text-align:center;\">".$lang_details['col_type']."</td><td class=\"colhead\" align=\"left\">".$lang_details['col_name']."</td><td class=\"colhead\" align=\"center\">".$lang_details['col_quality']."</td><td class=\"colhead\" align=\"center\"><img class=\"size\" src=\"pic/trans.gif\" alt=\"size\" title=\"".$lang_details['title_size']."\" /></td><td class=\"colhead\" align=\"center\"><img class=\"time\" src=\"pic/trans.gif\" alt=\"time added\" title=\"".$lang_details['title_time_added']."\" /></td><td class=\"colhead\" align=\"center\"><img class=\"seeders\" src=\"pic/trans.gif\" alt=\"seeders\" title=\"".$lang_details['title_seeders']."\" /></td><td class=\"colhead\" align=\"center\"><img class=\"leechers\" src=\"pic/trans.gif\" alt=\"leechers\" title=\"".$lang_details['title_leechers']."\" /></td></tr>\n";
while ($copy_row = mysql_fetch_assoc($copies_res))
{
$dispname = htmlspecialchars(trim($copy_row["name"]));
$count_dispname=strlen($dispname);
$max_lenght_of_torrent_name="80"; // maximum lenght
if($count_dispname > $max_lenght_of_torrent_name)
{
$dispname=substr($dispname, 0, $max_lenght_of_torrent_name) . "..";
}
if (isset($copy_row["source_name"]))
$other_source_info = $copy_row['source_name'].", ";
if (isset($copy_row["medium_name"]))
$other_medium_info = $copy_row['medium_name'].", ";
if (isset($copy_row["codec_name"]))
$other_codec_info = $copy_row['codec_name'].", ";
if (isset($copy_row["standard_name"]))
$other_standard_info = $copy_row['standard_name'].", ";
if (isset($copy_row["processing_name"]))
$other_processing_info = $copy_row['processing_name'].", ";
$sphighlight = get_torrent_bg_color($copy_row['sp_state']);
$sp_info = get_torrent_promotion_append($copy_row['sp_state']);
$s .= "<tr". $sphighlight."><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>".return_category_image($copy_row["catid"], "torrents.php?allsec=1&amp;")."</td><td class=\"rowfollow\" align=\"left\"><a href=\"" . htmlspecialchars(get_protocol_prefix() . $BASEURL . "/details.php?id=" . $copy_row["id"]. "&hit=1")."\">" . $dispname ."</a>". $sp_info."</td>" .
"<td class=\"rowfollow\" align=\"left\">" . rtrim(trim($other_source_info . $other_medium_info . $other_codec_info . $other_standard_info . $other_processing_info), ","). "</td>" .
"<td class=\"rowfollow\" align=\"center\">" . mksize($copy_row["size"]) . "</td>" .
"<td class=\"rowfollow nowrap\" align=\"center\">" . str_replace("&nbsp;", "<br />", gettime($copy_row["added"],false)). "</td>" .
"<td class=\"rowfollow\" align=\"center\">" . $copy_row["seeders"] . "</td>" .
"<td class=\"rowfollow\" align=\"center\">" . $copy_row["leechers"] . "</td>" .
"</tr>\n";
}
$s .= "</table>\n";
tr("<a href=\"javascript: klappe_news('othercopy')\"><span class=\"nowrap\"><img class=\"".($copies_count > 5 ? "plus" : "minus")."\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picothercopy\" title=\"".$lang_details['title_show_or_hide']."\" /> ".$lang_details['row_other_copies']."</span></a>", "<b>".$copies_count.$lang_details['text_other_copies']." </b><br /><div id='kothercopy' style=\"".($copies_count > 5 ? "display: none;" : "display: block;")."\">".$s."</div>",1);
}
}
if ($row["type"] == "multi")
{
$files_info = "<b>".$lang_details['text_num_files']."</b>". $row["numfiles"] . $lang_details['text_files'] . "<br />";
$files_info .= "<span id=\"showfl\"><a href=\"javascript: viewfilelist(".$id.")\" >".$lang_details['text_see_full_list']."</a></span><span id=\"hidefl\" style=\"display: none;\"><a href=\"javascript: hidefilelist()\">".$lang_details['text_hide_list']."</a></span>";
}
function hex_esc($matches) {
return sprintf("%02x", ord($matches[0]));
}
if ($enablenfo_main=='yes')
tr($lang_details['row_torrent_info'], "<table><tr>" . (!empty($files_info) ? "<td class=\"no_border_wide\">" . $files_info . "</td>" : "") . "<td class=\"no_border_wide\"><b>".$lang_details['row_info_hash'].":</b>&nbsp;".preg_replace_callback('/./s', "hex_esc", hash_pad($row["info_hash"]))."</td>". (get_user_class() >= $torrentstructure_class ? "<td class=\"no_border_wide\"><b>" . $lang_details['text_torrent_structure'] . "</b><a href=\"torrent_info.php?id=".$id."\">".$lang_details['text_torrent_info_note']."</a></td>" : "") . "</tr></table><span id='filelist'></span>",1);
tr($lang_details['row_hot_meter'], "<table><tr><td class=\"no_border_wide\"><b>" . $lang_details['text_views']."</b>". $row["views"] . "</td><td class=\"no_border_wide\"><b>" . $lang_details['text_hits']. "</b>" . $row["hits"] . "</td><td class=\"no_border_wide\"><b>" .$lang_details['text_snatched'] . "</b><a href=\"viewsnatches.php?id=".$id."\"><b>" . $row["times_completed"]. $lang_details['text_view_snatches'] . "</td><td class=\"no_border_wide\"><b>" . $lang_details['row_last_seeder']. "</b>" . gettime($row["last_action"]) . "</td></tr></table>",1);
$bwres = sql_query("SELECT uploadspeed.name AS upname, downloadspeed.name AS downname, isp.name AS ispname FROM users LEFT JOIN uploadspeed ON users.upload = uploadspeed.id LEFT JOIN downloadspeed ON users.download = downloadspeed.id LEFT JOIN isp ON users.isp = isp.id WHERE users.id=".$row['owner']);
$bwrow = mysql_fetch_array($bwres);
if ($bwrow['upname'] && $bwrow['downname'])
tr($lang_details['row_uploader_bandwidth'], "<img class=\"speed_down\" src=\"pic/trans.gif\" alt=\"Downstream Rate\" /> ".$bwrow['downname']."&nbsp;&nbsp;&nbsp;&nbsp;<img class=\"speed_up\" src=\"pic/trans.gif\" alt=\"Upstream Rate\" /> ".$bwrow['upname']."&nbsp;&nbsp;&nbsp;&nbsp;".$bwrow['ispname'],1);
/*
// Health
$seedersTmp = $row['seeders'];
$leechersTmp = $row['leechers'];
if ($leechersTmp >= 1) // it is possible that there's traffic while have no seeders
{
$progressPerTorrent = 0;
$i = 0;
$subres = sql_query("SELECT seeder, finishedat, downloadoffset, uploadoffset, ip, port, uploaded, downloaded, to_go, UNIX_TIMESTAMP(started) AS st, connectable, agent, peer_id, UNIX_TIMESTAMP(last_action) AS la, userid FROM peers WHERE torrent = $row[id]") or sqlerr();
while ($subrow = mysql_fetch_array($subres)) {
$progressPerTorrent += sprintf("%.2f", 100 * (1 - ($subrow["to_go"] / $row["size"])));
$i++;
if ($subrow["seeder"] == "yes")
$seeders[] = $subrow;
else
$downloaders[] = $subrow;
}
if ($i == 0)
$i = 1;
$progressTotal = sprintf("%.2f", $progressPerTorrent / $i);
$totalspeed = 0;
if($seedersTmp >=1)
{
if ($seeders) {
foreach($seeders as $e) {
$totalspeed = $totalspeed + ($e["uploaded"] - $e["uploadoffset"]) / max(1, ($e["la"] - $e["st"]));
$totalspeed = $totalspeed + ($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e[st]);
}
}
}
if ($downloaders) {
foreach($downloaders as $e) {
$totalspeed = $totalspeed + ($e["uploaded"] - $e["uploadoffset"]) / max(1, ($e["la"] - $e["st"]));
$totalspeed = $totalspeed + ($e["downloaded"] - $e["downloadoffset"]) / max(1, ($e["la"] - $e["st"]));
}
}
$avgspeed = $lang_details['text_average_speed']."<b>" . mksize($totalspeed/($seedersTmp+$leechersTmp)) . "/s</b>";
$totalspeed = $lang_details['text_total_speed']."<b>" . mksize($totalspeed) . "/s</b> ".$lang_details['text_health_note'];
$health = $lang_details['text_avprogress'] . get_percent_completed_image(floor($progressTotal))." (".round($progressTotal)."%)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>".$lang_details['text_traffic']."</b>" . $avgspeed ."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;". $totalspeed;
}
else
$health = "<b>".$lang_details['text_traffic']. "</b>" . $lang_details['text_no_traffic'];
if ($row["visible"] == "no")
$health = "<b>".$lang_details['text_status']."</b>" . $lang_details['text_dead'] ."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;". $health;
tr($lang_details['row_health'], $health, 1);*/
tr("<span id=\"seeders\"></span><span id=\"leechers\"></span>".$lang_details['row_peers']."<br /><span id=\"showpeer\"><a href=\"javascript: viewpeerlist(".$row['id'].");\" class=\"sublink\">".$lang_details['text_see_full_list']."</a></span><span id=\"hidepeer\" style=\"display: none;\"><a href=\"javascript: hidepeerlist();\" class=\"sublink\">".$lang_details['text_hide_list']."</a></span>", "<div id=\"peercount\"><b>".$row['seeders'].$lang_details['text_seeders'].add_s($row['seeders'])."</b> | <b>".$row['leechers'].$lang_details['text_leechers'].add_s($row['leechers'])."</b></div><div id=\"peerlist\"></div>" , 1);
if (isset($_GET['dllist']) && $_GET['dllist'] == 1)
{
$scronload = "viewpeerlist(".$row['id'].")";
echo "<script type=\"text/javascript\">\n";
echo $scronload;
echo "</script>";
}
// ------------- start thanked-by block--------------//
$torrentid = $id;
$thanksby = "";
$nothanks = "";
$thanks_said = 0;
$thanks_sql = sql_query("SELECT userid FROM thanks WHERE torrentid=".sqlesc($torrentid)." ORDER BY id DESC LIMIT 20");
$thanksCount = get_row_count("thanks", "WHERE torrentid=".sqlesc($torrentid));
$thanks_all = mysql_num_rows($thanks_sql);
if ($thanks_all) {
while($rows_t = mysql_fetch_array($thanks_sql)) {
$thanks_userid = $rows_t["userid"];
if ($rows_t["userid"] == $CURUSER['id']) {
$thanks_said = 1;
} else {
$thanksby .= get_username($thanks_userid)." ";
}
}
}
else $nothanks = $lang_details['text_no_thanks_added'];
if (!$thanks_said) {
$thanks_said = get_row_count("thanks", "WHERE torrentid=$torrentid AND userid=".sqlesc($CURUSER['id']));
}
if ($thanks_said == 0) {
$buttonvalue = " value=\"".$lang_details['submit_say_thanks']."\"";
} else {
$buttonvalue = " value=\"".$lang_details['submit_you_said_thanks']."\" disabled=\"disabled\"";
$thanksby = get_username($CURUSER['id'])." ".$thanksby;
}
$thanksbutton = "<input class=\"btn\" type=\"button\" id=\"saythanks\" onclick=\"saythanks(".$torrentid.");\" ".$buttonvalue." />";
tr($lang_details['row_thanks_by'],"<span id=\"thanksadded\" style=\"display: none;\"><input class=\"btn\" type=\"button\" value=\"".$lang_details['text_thanks_added']."\" disabled=\"disabled\" /></span><span id=\"curuser\" style=\"display: none;\">".get_username($CURUSER['id'])." </span><span id=\"thanksbutton\">".$thanksbutton."</span>&nbsp;&nbsp;<span id=\"nothanks\">".$nothanks."</span><span id=\"addcuruser\"></span>".$thanksby.($thanks_all < $thanksCount ? $lang_details['text_and_more'].$thanksCount.$lang_details['text_users_in_total'] : ""),1);
// ------------- end thanked-by block--------------//
print("</table>\n");
}
else {
stdhead($lang_details['head_comments_for_torrent']."\"" . $row["name"] . "\"");
print("<h1 id=\"top\">".$lang_details['text_comments_for']."<a href=\"details.php?id=".$id."\">" . htmlspecialchars($row["name"]) . "</a></h1>\n");
}
// -----------------COMMENT SECTION ---------------------//
if ($CURUSER['showcomment'] != 'no'){
$count = get_row_count("comments","WHERE torrent=".sqlesc($id));
if ($count)
{
print("<br /><br />");
print("<h1 align=\"center\" id=\"startcomments\">" .$lang_details['h1_user_comments'] . "</h1>\n");
list($pagertop, $pagerbottom, $limit) = pager(10, $count, "details.php?id=$id&cmtpage=1&", array('lastpagedefault' => 1), "page");
$subres = sql_query("SELECT id, text, user, added, editedby, editdate FROM comments WHERE torrent = $id ORDER BY id $limit") or sqlerr(__FILE__, __LINE__);
$allrows = array();
while ($subrow = mysql_fetch_array($subres)) {
$allrows[] = $subrow;
}
print($pagertop);
commenttable($allrows,"torrent",$id);
print($pagerbottom);
}
}
print("<br /><br />");
print ("<table style='border:1px solid #000000;'><tr><td class=\"text\" align=\"center\"><b>".$lang_details['text_quick_comment']."</b><br /><br /><form id=\"compose\" name=\"comment\" method=\"post\" action=\"".htmlspecialchars("comment.php?action=add&type=torrent")."\" onsubmit=\"return postvalid(this);\"><input type=\"hidden\" name=\"pid\" value=\"".$id."\" /><br />");
quickreply('comment', 'body', $lang_details['submit_add_comment']);
print("</form></td></tr></table>");
print("<p align=\"center\"><a class=\"index\" href=\"".htmlspecialchars("comment.php?action=add&pid=".$id."&type=torrent")."\">".$lang_details['text_add_a_comment']."</a></p>\n");
}
stdfoot();
+28
View File
@@ -0,0 +1,28 @@
<?php
ob_start();
require_once("../include/bittorrent.php");
dbconn();
if (get_user_class() < UC_SYSOP) {
die('forbidden');
}
echo "<html><head><title>Do Clean-up</title></head><body>";
echo "<p>";
echo "clean-up in progress...please wait<br />";
ob_flush();
flush();
if (isset($_GET['forceall']) && $_GET['forceall']) {
$forceall = 1;
} else {
$forceall = 0;
echo "you may force full clean-up by adding the parameter 'forceall=1' to URL<br />";
}
echo "</p>";
$tstart = getmicrotime();
require_once("include/cleanup.php");
print("<p>".docleanup($forceall, 1)."</p>");
$tend = getmicrotime();
$totaltime = ($tend - $tstart);
printf ("Time consumed: %f sec<br />", $totaltime);
echo "Done<br />";
echo "</body></html>";
+704
View File
@@ -0,0 +1,704 @@
/** $Id: domLib.js 2321 2006-06-12 06:45:41Z dallen $ */
// {{{ license
/*
* Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// }}}
// {{{ intro
/**
* Title: DOM Library Core
* Version: 0.70
*
* Summary:
* A set of commonly used functions that make it easier to create javascript
* applications that rely on the DOM.
*
* Updated: 2005/05/17
*
* Maintainer: Dan Allen <dan.allen@mojavelinux.com>
* Maintainer: Jason Rust <jrust@rustyparts.com>
*
* License: Apache 2.0
*/
// }}}
// {{{ global constants (DO NOT EDIT)
// -- Browser Detection --
var domLib_userAgent = navigator.userAgent.toLowerCase();
var domLib_isMac = navigator.appVersion.indexOf('Mac') != -1;
var domLib_isWin = domLib_userAgent.indexOf('windows') != -1;
// NOTE: could use window.opera for detecting Opera
var domLib_isOpera = domLib_userAgent.indexOf('opera') != -1;
var domLib_isOpera7up = domLib_userAgent.match(/opera.(7|8)/i);
var domLib_isSafari = domLib_userAgent.indexOf('safari') != -1;
var domLib_isKonq = domLib_userAgent.indexOf('konqueror') != -1;
// Both konqueror and safari use the khtml rendering engine
var domLib_isKHTML = (domLib_isKonq || domLib_isSafari || domLib_userAgent.indexOf('khtml') != -1);
var domLib_isIE = (!domLib_isKHTML && !domLib_isOpera && domLib_userAgent.indexOf('msie') != -1);
var domLib_isIE5up = domLib_isIE;
var domLib_isIE50 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.0') != -1);
var domLib_isIE55 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.5') != -1);
var domLib_isIE5 = (domLib_isIE50 || domLib_isIE55);
// safari and konq may use string "khtml, like gecko", so check for destinctive /
var domLib_isGecko = domLib_userAgent.indexOf('gecko/') != -1;
var domLib_isMacIE = (domLib_isIE && domLib_isMac);
var domLib_isIE55up = domLib_isIE5up && !domLib_isIE50 && !domLib_isMacIE;
var domLib_isIE6up = domLib_isIE55up && !domLib_isIE55;
// -- Browser Abilities --
var domLib_standardsMode = (document.compatMode && document.compatMode == 'CSS1Compat');
var domLib_useLibrary = (domLib_isOpera7up || domLib_isKHTML || domLib_isIE5up || domLib_isGecko || domLib_isMacIE || document.defaultView);
// fixed in Konq3.2
var domLib_hasBrokenTimeout = (domLib_isMacIE || (domLib_isKonq && domLib_userAgent.match(/konqueror\/3.([2-9])/) == null));
var domLib_canFade = (domLib_isGecko || domLib_isIE || domLib_isSafari || domLib_isOpera);
var domLib_canDrawOverSelect = (domLib_isMac || domLib_isOpera || domLib_isGecko);
var domLib_canDrawOverFlash = (domLib_isMac || domLib_isWin);
// -- Event Variables --
var domLib_eventTarget = domLib_isIE ? 'srcElement' : 'currentTarget';
var domLib_eventButton = domLib_isIE ? 'button' : 'which';
var domLib_eventTo = domLib_isIE ? 'toElement' : 'relatedTarget';
var domLib_stylePointer = domLib_isIE ? 'hand' : 'pointer';
// NOTE: a bug exists in Opera that prevents maxWidth from being set to 'none', so we make it huge
var domLib_styleNoMaxWidth = domLib_isOpera ? '10000px' : 'none';
var domLib_hidePosition = '-1000px';
var domLib_scrollbarWidth = 14;
var domLib_autoId = 1;
var domLib_zIndex = 100;
// -- Detection --
var domLib_collisionElements;
var domLib_collisionsCached = false;
var domLib_timeoutStateId = 0;
var domLib_timeoutStates = new Hash();
// }}}
// {{{ DOM enhancements
if (!document.ELEMENT_NODE)
{
document.ELEMENT_NODE = 1;
document.ATTRIBUTE_NODE = 2;
document.TEXT_NODE = 3;
document.DOCUMENT_NODE = 9;
document.DOCUMENT_FRAGMENT_NODE = 11;
}
function domLib_clone(obj)
{
var copy = {};
for (var i in obj)
{
var value = obj[i];
try
{
if (value != null && typeof(value) == 'object' && value != window && !value.nodeType)
{
copy[i] = domLib_clone(value);
}
else
{
copy[i] = value;
}
}
catch(e)
{
copy[i] = value;
}
}
return copy;
}
// }}}
// {{{ class Hash()
function Hash()
{
this.length = 0;
this.numericLength = 0;
this.elementData = [];
for (var i = 0; i < arguments.length; i += 2)
{
if (typeof(arguments[i + 1]) != 'undefined')
{
this.elementData[arguments[i]] = arguments[i + 1];
this.length++;
if (arguments[i] == parseInt(arguments[i]))
{
this.numericLength++;
}
}
}
}
// using prototype as opposed to inner functions saves on memory
Hash.prototype.get = function(in_key)
{
if (typeof(this.elementData[in_key]) != 'undefined') {
return this.elementData[in_key];
}
return null;
}
Hash.prototype.set = function(in_key, in_value)
{
if (typeof(in_value) != 'undefined')
{
if (typeof(this.elementData[in_key]) == 'undefined')
{
this.length++;
if (in_key == parseInt(in_key))
{
this.numericLength++;
}
}
return this.elementData[in_key] = in_value;
}
return false;
}
Hash.prototype.remove = function(in_key)
{
var tmp_value;
if (typeof(this.elementData[in_key]) != 'undefined')
{
this.length--;
if (in_key == parseInt(in_key))
{
this.numericLength--;
}
tmp_value = this.elementData[in_key];
delete this.elementData[in_key];
}
return tmp_value;
}
Hash.prototype.size = function()
{
return this.length;
}
Hash.prototype.has = function(in_key)
{
return typeof(this.elementData[in_key]) != 'undefined';
}
Hash.prototype.find = function(in_obj)
{
for (var tmp_key in this.elementData)
{
if (this.elementData[tmp_key] == in_obj)
{
return tmp_key;
}
}
return null;
}
Hash.prototype.merge = function(in_hash)
{
for (var tmp_key in in_hash.elementData)
{
if (typeof(this.elementData[tmp_key]) == 'undefined')
{
this.length++;
if (tmp_key == parseInt(tmp_key))
{
this.numericLength++;
}
}
this.elementData[tmp_key] = in_hash.elementData[tmp_key];
}
}
Hash.prototype.compare = function(in_hash)
{
if (this.length != in_hash.length)
{
return false;
}
for (var tmp_key in this.elementData)
{
if (this.elementData[tmp_key] != in_hash.elementData[tmp_key])
{
return false;
}
}
return true;
}
// }}}
// {{{ domLib_isDescendantOf()
function domLib_isDescendantOf(in_object, in_ancestor, in_bannedTags)
{
if (in_object == null)
{
return false;
}
if (in_object == in_ancestor)
{
return true;
}
if (typeof(in_bannedTags) != 'undefined' &&
(',' + in_bannedTags.join(',') + ',').indexOf(',' + in_object.tagName + ',') != -1)
{
return false;
}
while (in_object != document.documentElement)
{
try
{
if ((tmp_object = in_object.offsetParent) && tmp_object == in_ancestor)
{
return true;
}
else if ((tmp_object = in_object.parentNode) == in_ancestor)
{
return true;
}
else
{
in_object = tmp_object;
}
}
// in case we get some wierd error, assume we left the building
catch(e)
{
return false;
}
}
return false;
}
// }}}
// {{{ domLib_detectCollisions()
/**
* For any given target element, determine if elements on the page
* are colliding with it that do not obey the rules of z-index.
*/
function domLib_detectCollisions(in_object, in_recover, in_useCache)
{
// the reason for the cache is that if the root menu is built before
// the page is done loading, then it might not find all the elements.
// so really the only time you don't use cache is when building the
// menu as part of the page load
if (!domLib_collisionsCached)
{
var tags = [];
if (!domLib_canDrawOverFlash)
{
tags[tags.length] = 'object';
}
if (!domLib_canDrawOverSelect)
{
tags[tags.length] = 'select';
}
domLib_collisionElements = domLib_getElementsByTagNames(tags, true);
domLib_collisionsCached = in_useCache;
}
// if we don't have a tip, then unhide selects
if (in_recover)
{
for (var cnt = 0; cnt < domLib_collisionElements.length; cnt++)
{
var thisElement = domLib_collisionElements[cnt];
if (!thisElement.hideList)
{
thisElement.hideList = new Hash();
}
thisElement.hideList.remove(in_object.id);
if (!thisElement.hideList.length)
{
domLib_collisionElements[cnt].style.visibility = 'visible';
if (domLib_isKonq)
{
domLib_collisionElements[cnt].style.display = '';
}
}
}
return;
}
else if (domLib_collisionElements.length == 0)
{
return;
}
// okay, we have a tip, so hunt and destroy
var objectOffsets = domLib_getOffsets(in_object);
for (var cnt = 0; cnt < domLib_collisionElements.length; cnt++)
{
var thisElement = domLib_collisionElements[cnt];
// if collision element is in active element, move on
// WARNING: is this too costly?
if (domLib_isDescendantOf(thisElement, in_object))
{
continue;
}
// konqueror only has trouble with multirow selects
if (domLib_isKonq &&
thisElement.tagName == 'SELECT' &&
(thisElement.size <= 1 && !thisElement.multiple))
{
continue;
}
if (!thisElement.hideList)
{
thisElement.hideList = new Hash();
}
var selectOffsets = domLib_getOffsets(thisElement);
var center2centerDistance = Math.sqrt(Math.pow(selectOffsets.get('leftCenter') - objectOffsets.get('leftCenter'), 2) + Math.pow(selectOffsets.get('topCenter') - objectOffsets.get('topCenter'), 2));
var radiusSum = selectOffsets.get('radius') + objectOffsets.get('radius');
// the encompassing circles are overlapping, get in for a closer look
if (center2centerDistance < radiusSum)
{
// tip is left of select
if ((objectOffsets.get('leftCenter') <= selectOffsets.get('leftCenter') && objectOffsets.get('right') < selectOffsets.get('left')) ||
// tip is right of select
(objectOffsets.get('leftCenter') > selectOffsets.get('leftCenter') && objectOffsets.get('left') > selectOffsets.get('right')) ||
// tip is above select
(objectOffsets.get('topCenter') <= selectOffsets.get('topCenter') && objectOffsets.get('bottom') < selectOffsets.get('top')) ||
// tip is below select
(objectOffsets.get('topCenter') > selectOffsets.get('topCenter') && objectOffsets.get('top') > selectOffsets.get('bottom')))
{
thisElement.hideList.remove(in_object.id);
if (!thisElement.hideList.length)
{
thisElement.style.visibility = 'visible';
if (domLib_isKonq)
{
thisElement.style.display = '';
}
}
}
else
{
thisElement.hideList.set(in_object.id, true);
thisElement.style.visibility = 'hidden';
if (domLib_isKonq)
{
thisElement.style.display = 'none';
}
}
}
}
}
// }}}
// {{{ domLib_getOffsets()
function domLib_getOffsets(in_object, in_preserveScroll)
{
if (typeof(in_preserveScroll) == 'undefined') {
in_preserveScroll = false;
}
var originalObject = in_object;
var originalWidth = in_object.offsetWidth;
var originalHeight = in_object.offsetHeight;
var offsetLeft = 0;
var offsetTop = 0;
while (in_object)
{
offsetLeft += in_object.offsetLeft;
offsetTop += in_object.offsetTop;
in_object = in_object.offsetParent;
// consider scroll offset of parent elements
if (in_object && !in_preserveScroll)
{
offsetLeft -= in_object.scrollLeft;
offsetTop -= in_object.scrollTop;
}
}
// MacIE misreports the offsets (even with margin: 0 in body{}), still not perfect
if (domLib_isMacIE) {
offsetLeft += 10;
offsetTop += 10;
}
return new Hash(
'left', offsetLeft,
'top', offsetTop,
'right', offsetLeft + originalWidth,
'bottom', offsetTop + originalHeight,
'leftCenter', offsetLeft + originalWidth/2,
'topCenter', offsetTop + originalHeight/2,
'radius', Math.max(originalWidth, originalHeight)
);
}
// }}}
// {{{ domLib_setTimeout()
function domLib_setTimeout(in_function, in_timeout, in_args)
{
if (typeof(in_args) == 'undefined')
{
in_args = [];
}
if (in_timeout == -1)
{
// timeout event is disabled
return 0;
}
else if (in_timeout == 0)
{
in_function(in_args);
return 0;
}
// must make a copy of the arguments so that we release the reference
var args = domLib_clone(in_args);
if (!domLib_hasBrokenTimeout)
{
return setTimeout(function() { in_function(args); }, in_timeout);
}
else
{
var id = domLib_timeoutStateId++;
var data = new Hash();
data.set('function', in_function);
data.set('args', args);
domLib_timeoutStates.set(id, data);
data.set('timeoutId', setTimeout('domLib_timeoutStates.get(' + id + ').get(\'function\')(domLib_timeoutStates.get(' + id + ').get(\'args\')); domLib_timeoutStates.remove(' + id + ');', in_timeout));
return id;
}
}
// }}}
// {{{ domLib_clearTimeout()
function domLib_clearTimeout(in_id)
{
if (!domLib_hasBrokenTimeout)
{
if (in_id > 0) {
clearTimeout(in_id);
}
}
else
{
if (domLib_timeoutStates.has(in_id))
{
clearTimeout(domLib_timeoutStates.get(in_id).get('timeoutId'))
domLib_timeoutStates.remove(in_id);
}
}
}
// }}}
// {{{ domLib_getEventPosition()
function domLib_getEventPosition(in_eventObj)
{
var eventPosition = new Hash('x', 0, 'y', 0, 'scrollX', 0, 'scrollY', 0);
// IE varies depending on standard compliance mode
if (domLib_isIE)
{
var doc = (domLib_standardsMode ? document.documentElement : document.body);
// NOTE: events may fire before the body has been loaded
if (doc)
{
eventPosition.set('x', in_eventObj.clientX + doc.scrollLeft);
eventPosition.set('y', in_eventObj.clientY + doc.scrollTop);
eventPosition.set('scrollX', doc.scrollLeft);
eventPosition.set('scrollY', doc.scrollTop);
}
} else {
eventPosition.set('x', in_eventObj.pageX);
eventPosition.set('y', in_eventObj.pageY);
eventPosition.set('scrollX', in_eventObj.pageX - in_eventObj.clientX);
eventPosition.set('scrollY', in_eventObj.pageY - in_eventObj.clientY);
}
return eventPosition;
}
// }}}
// {{{ domLib_cancelBubble()
function domLib_cancelBubble(in_event)
{
var eventObj = in_event ? in_event : window.event;
eventObj.cancelBubble = true;
}
// }}}
// {{{ domLib_getIFrameReference()
function domLib_getIFrameReference(in_frame)
{
if (domLib_isGecko || domLib_isIE)
{
return in_frame.frameElement;
}
else
{
// we could either do it this way or require an id on the frame
// equivalent to the name
var name = in_frame.name;
if (!name || !in_frame.parent)
{
return null;
}
var candidates = in_frame.parent.document.getElementsByTagName('iframe');
for (var i = 0; i < candidates.length; i++)
{
if (candidates[i].name == name)
{
return candidates[i];
}
}
return null;
}
}
// }}}
// {{{ domLib_getElementsByClass()
function domLib_getElementsByClass(in_class)
{
var elements = domLib_isIE5 ? document.all : document.getElementsByTagName('*');
var matches = [];
var cnt = 0;
for (var i = 0; i < elements.length; i++)
{
if ((" " + elements[i].className + " ").indexOf(" " + in_class + " ") != -1)
{
matches[cnt++] = elements[i];
}
}
return matches;
}
// }}}
// {{{ domLib_getElementsByTagNames()
function domLib_getElementsByTagNames(in_list, in_excludeHidden)
{
var elements = [];
for (var i = 0; i < in_list.length; i++)
{
var matches = document.getElementsByTagName(in_list[i]);
for (var j = 0; j < matches.length; j++)
{
// skip objects that have nested embeds, or else we get "flashing"
if (matches[j].tagName == 'OBJECT' && domLib_isGecko)
{
var kids = matches[j].childNodes;
var skip = false;
for (var k = 0; k < kids.length; k++)
{
if (kids[k].tagName == 'EMBED')
{
skip = true;
break;
}
}
if (skip) continue;
}
if (in_excludeHidden && domLib_getComputedStyle(matches[j], 'visibility') == 'hidden')
{
continue;
}
elements[elements.length] = matches[j];
}
}
return elements;
}
// }}}
// {{{ domLib_getComputedStyle()
function domLib_getComputedStyle(in_obj, in_property)
{
if (domLib_isIE)
{
var humpBackProp = in_property.replace(/-(.)/, function (a, b) { return b.toUpperCase(); });
return eval('in_obj.currentStyle.' + humpBackProp);
}
// getComputedStyle() is broken in konqueror, so let's go for the style object
else if (domLib_isKonq)
{
//var humpBackProp = in_property.replace(/-(.)/, function (a, b) { return b.toUpperCase(); });
return eval('in_obj.style.' + in_property);
}
else
{
return document.defaultView.getComputedStyle(in_obj, null).getPropertyValue(in_property);
}
}
// }}}
// {{{ makeTrue()
function makeTrue()
{
return true;
}
// }}}
// {{{ makeFalse()
function makeFalse()
{
return false;
}
// }}}
+1132
View File
File diff suppressed because it is too large Load Diff
+102
View File
@@ -0,0 +1,102 @@
/** $Id: domTT_drag.js 2315 2006-06-12 05:45:36Z dallen $ */
// {{{ license
/*
* Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// }}}
// {{{ globals (DO NOT EDIT)
var domTT_dragEnabled = true;
var domTT_currentDragTarget;
var domTT_dragMouseDown;
var domTT_dragOffsetLeft;
var domTT_dragOffsetTop;
// }}}
// {{{ domTT_dragStart()
function domTT_dragStart(in_this, in_event)
{
if (typeof(in_event) == 'undefined') { in_event = window.event; }
var eventButton = in_event[domLib_eventButton];
if (eventButton != 1 && !domLib_isKHTML)
{
return;
}
domTT_currentDragTarget = in_this;
in_this.style.cursor = 'move';
// upgrade our z-index
in_this.style.zIndex = ++domLib_zIndex;
var eventPosition = domLib_getEventPosition(in_event);
var targetPosition = domLib_getOffsets(in_this);
domTT_dragOffsetLeft = eventPosition.get('x') - targetPosition.get('left');
domTT_dragOffsetTop = eventPosition.get('y') - targetPosition.get('top');
domTT_dragMouseDown = true;
}
// }}}
// {{{ domTT_dragUpdate()
function domTT_dragUpdate(in_event)
{
if (domTT_dragMouseDown)
{
if (domLib_isGecko)
{
window.getSelection().removeAllRanges()
}
if (domTT_useGlobalMousePosition && domTT_mousePosition != null)
{
var eventPosition = domTT_mousePosition;
}
else
{
if (typeof(in_event) == 'undefined') { in_event = window.event; }
var eventPosition = domLib_getEventPosition(in_event);
}
domTT_currentDragTarget.style.left = (eventPosition.get('x') - domTT_dragOffsetLeft) + 'px';
domTT_currentDragTarget.style.top = (eventPosition.get('y') - domTT_dragOffsetTop) + 'px';
// update the collision detection
domLib_detectCollisions(domTT_currentDragTarget);
}
}
// }}}
// {{{ domTT_dragStop()
function domTT_dragStop()
{
if (domTT_dragMouseDown) {
domTT_dragMouseDown = false;
domTT_currentDragTarget.style.cursor = 'default';
domTT_currentDragTarget = null;
if (domLib_isGecko)
{
window.getSelection().removeAllRanges()
}
}
}
// }}}
+100
View File
@@ -0,0 +1,100 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
if ($enabledonation != 'yes')
stderr($lang_donate['std_sorry'], $lang_donate['std_do_not_accept_donation']);
$do = $_GET['do'] ?? '';
if ($do == 'thanks') {
stderr($lang_donate['std_success'], $lang_donate['std_donation_success_note_one']."<a href=\"sendmessage.php?receiver=".$ACCOUNTANTID."\"><b>".$lang_donate['std_here']."</b></a>".$lang_donate['std_donation_success_note_two'], false);
}
else
{
$paypal = safe_email($PAYPALACCOUNT);
if ($paypal && check_email($paypal))
$showpaypal = true;
else
$showpaypal = false;
$alipay = safe_email($ALIPAYACCOUNT);
if ($alipay && check_email($alipay))
$showalipay = true;
else
$showalipay = false;
if ($showpaypal && $showalipay)
$tdattr = "width=\"50%\"";
elseif ($showpaypal || $showalipay)
$tdattr = "colspan=\"2\" width=\"100%\"";
else
stderr($lang_donate['std_error'], $lang_donate['std_no_donation_account_available'], false);
stdhead($lang_donate['head_donation']);
begin_main_frame();
print("<h2>".$lang_donate['text_donate']."</h2>");
print("<table width=100%><tr>");
print("<td colspan=2 class=text align=left>".$lang_donate['text_donation_note']."</td></tr>");
print("<tr>");
if ($showpaypal){
?>
<td class=text align=left valign=top <?php echo $tdattr?>>
<b><?php echo $lang_donate['text_donate_with_paypal']?></b><br /><br />
<?php echo $lang_donate['text_donate_paypal_note']?>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?php echo $paypal;?>">
<input type="hidden" name="item_name" value="Donation to <?php echo $SITENAME;?>">
<p align="center">
<br />
<?php echo $lang_donate['text_select_donation_amount']?>
<br />
<select name="amount">
<option value="" selected><?php echo $lang_donate['select_choose_donation_amount']?></option>
<?php
$allowedDonationUsdAmounts = array(0, 1, 5, 10, 15, 20, 30, 40, 50, 60, 100, 300);
//$allowedDonationUsdAmounts = array(32, 64, 320);
foreach ($allowedDonationUsdAmounts as $amount) {
if ($amount == 0) {
echo '<option value="">'.$lang_donate['select_other_donation_amount'].'</option>';
} else {
$amount = number_format($amount, 2);
echo '<option value='.$amount.'>'.$lang_donate['text_usd_mark'].$amount.$lang_donate['text_donation'].'</option>';
}
}
?>
</select>
<input type="hidden" name="image_url" value="">
<input type="hidden" name="shipping" value="0">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="<?php echo get_protocol_prefix() . $BASEURL;?>/donate.php?do=thanks">
<input type="hidden" name="cancel_return" value="<?php echo get_protocol_prefix() . $BASEURL;?>/donate.php">
<br />
</p>
<p align="center">
<input type="image" src="pic/paypalbutton.gif" border="0" name="I1" alt="Make payments with PayPal">
<br /><br /></p>
</form></td>
<?php
}
if ($showalipay){
?>
<td class=text align=left valign=top <?php echo $tdattr?>>
<b><?php echo $lang_donate['text_donate_with_alipay']?></b><br /><br />
<form action="https://www.alipay.com/trade/fast_pay.htm" method="get">
<?php echo $lang_donate['text_donate_alipay_note_one']."<b>".$alipay."</b>".$lang_donate['text_donate_alipay_note_two']?>
<br /><br /><br /><br /><br />
<p align="center">
<input type="image" src="pic/alipaybutton.gif" border="0" name="I2" alt="Make payments with Alipay" />
<br /><br /></p>
</form></td>
<?php
}
print("</tr>");
print("<tr><td class=text colspan=2 align=left>".$lang_donate['text_after_donation_note_one']
."<a href=\"sendmessage.php?receiver=".$ACCOUNTANTID."\"><font class=\"striking\"><b>".$lang_donate['text_send_us']."</b></font></a>".$lang_donate['text_after_donation_note_two']."</td></tr>");
print("</table>");
end_main_frame();
stdfoot();
}
?>
+32
View File
@@ -0,0 +1,32 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_SYSOP)
stderr("Error", "Access denied.");
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if ($_POST["username"] == "" || $_POST["donated"] == "")
stderr("Error", "Missing form data.");
$username = sqlesc($_POST["username"]);
$donated = sqlesc($_POST["donated"]);
sql_query("UPDATE users SET donated=$donated WHERE username=$username") or sqlerr(__FILE__, __LINE__);
$res = sql_query("SELECT id FROM users WHERE username=$username");
$arr = mysql_fetch_row($res);
if (!$arr)
stderr("Error", "Unable to update account.");
header("Location: " . get_protocol_prefix() . "$BASEURL/userdetails.php?id=$arr[0]");
die;
}
stdhead("Update Users Donated Amounts");
?>
<h1>Update Users Donated Amounts</h1>
<form method=post action=donated.php>
<table border=1 cellspacing=0 cellpadding=5>
<tr><td class=rowhead>User name</td><td><input type=text name=username size=40></td></tr>
<tr><td class=rowhead>Donated</td><td><input type=uploaded name=donated size=5></td></tr>
<tr><td colspan=2 align=center><input type=submit value="Okay" class=btn></td></tr>
</table>
</form>
<?php stdfoot();
+43
View File
@@ -0,0 +1,43 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() > UC_MODERATOR) {
$res = sql_query("SELECT COUNT(*) FROM users WHERE donor='yes'");
$row = mysql_fetch_array($res);
$count = $row[0];
list($pagertop, $pagerbottom, $limit) = pager(50, $count, "donorlist.php?");
stdhead("Donorlist");
if (mysql_num_rows($res) == 0)
begin_main_frame();
// ===================================
$users = number_format(get_row_count("users", "WHERE donor='yes'"));
begin_frame("Donor List ($users)", true);
begin_table();
echo $pagerbottom;
?>
<form method="post">
<tr><td class="colhead">ID</td><td class="colhead" align="left">Username</td><td class="colhead" align="left">e-mail</td><td class="colhead" align="left">Joined</td><td class="colhead" align="left">How much?</td></tr>
<?php
$res=sql_query("SELECT id,username,email,added,donated FROM users WHERE donor='yes' ORDER BY id DESC $limit") or print(mysql_error());
// ------------------
while ($arr = @mysql_fetch_assoc($res)) {
echo "<tr><td>" . $arr[id] . "</td><td align=\"left\">" . get_username($arr[id]) . "</td><td align=\"left\"><a href=mailto:" . $arr[email] . ">" . $arr[email] . "</a></td><td align=\"left\">" . $arr[added] . "</a></td><td align=\"left\">$" . $arr[donated] . "</td></tr>";
}
?>
</form>
<?php
// ------------------
end_table();
end_frame();
// ===================================
end_main_frame();
stdfoot();
}
else {
stderr("Sorry", "Access denied!");
}
+153
View File
@@ -0,0 +1,153 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
$id = (int)$_GET["id"];
if (!$id)
httperr();
$passkey = $_GET['passkey'] ?? '';
if ($passkey){
$res = sql_query("SELECT * FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");
$user = mysql_fetch_array($res);
if (!$user)
die("invalid passkey");
elseif ($user['enabled'] == 'no' || $user['parked'] == 'yes')
die("account disabed or parked");
$oldip = $user['ip'];
$user['ip'] = getip();
$CURUSER = $user;
}
else
{
loggedinorreturn();
parked();
$letdown = intval($_GET['letdown'] ?? 0);
if (!$letdown && $CURUSER['showdlnotice'] == 1)
{
header("Location: " . get_protocol_prefix() . "$BASEURL/downloadnotice.php?torrentid=".$id."&type=firsttime");
}
elseif (!$letdown && $CURUSER['showclienterror'] == 'yes')
{
header("Location: " . get_protocol_prefix() . "$BASEURL/downloadnotice.php?torrentid=".$id."&type=client");
}
elseif (!$letdown && $CURUSER['leechwarn'] == 'yes')
{
header("Location: " . get_protocol_prefix() . "$BASEURL/downloadnotice.php?torrentid=".$id."&type=ratio");
}
}
//User may choose to download torrent from RSS. So log ip changes when downloading torrents.
if ($iplog1 == "yes") {
if (($oldip != $CURUSER["ip"]) && $CURUSER["ip"])
sql_query("INSERT INTO iplog (ip, userid, access) VALUES (" . sqlesc($CURUSER['ip']) . ", " . $CURUSER['id'] . ", '" . $CURUSER['last_access'] . "')");
}
//User may choose to download torrent from RSS. So update his last_access and ip when downloading torrents.
sql_query("UPDATE users SET last_access = ".sqlesc(date("Y-m-d H:i:s")).", ip = ".sqlesc($CURUSER['ip'])." WHERE id = ".sqlesc($CURUSER['id']));
/*
@ini_set('zlib.output_compression', 'Off');
@set_time_limit(0);
if (@ini_get('output_handler') == 'ob_gzhandler' AND @ob_get_length() !== false)
{ // if output_handler = ob_gzhandler, turn it off and remove the header sent by PHP
@ob_end_clean();
header('Content-Encoding:');
}
*/
if ($_COOKIE["c_secure_tracker_ssl"] == base64("yeah"))
$tracker_ssl = true;
else
$tracker_ssl = false;
if ($tracker_ssl == true){
$ssl_torrent = "https://";
if ($https_announce_urls[0] != "")
$base_announce_url = $https_announce_urls[0];
else
$base_announce_url = $announce_urls[0];
}
else{
$ssl_torrent = "http://";
$base_announce_url = $announce_urls[0];
}
$res = sql_query("SELECT name, filename, save_as, size, owner,banned FROM torrents WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_assoc($res);
$fn = "$torrent_dir/$id.torrent";
if ($CURUSER['downloadpos']=="no")
permissiondenied();
if (!$row || !is_file($fn) || !is_readable($fn))
httperr();
if ($row['banned'] == 'yes' && get_user_class() < $seebanned_class)
permissiondenied();
sql_query("UPDATE torrents SET hits = hits + 1 WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
require_once "include/benc.php";
if (strlen($CURUSER['passkey']) != 32) {
$CURUSER['passkey'] = md5($CURUSER['username'].date("Y-m-d H:i:s").$CURUSER['passhash']);
sql_query("UPDATE users SET passkey=".sqlesc($CURUSER['passkey'])." WHERE id=".sqlesc($CURUSER['id']));
}
$dict = bdec_file($fn, $max_torrent_size);
$dict['value']['announce']['value'] = $ssl_torrent . $base_announce_url . "?passkey=$CURUSER[passkey]";
$dict['value']['announce']['string'] = strlen($dict['value']['announce']['value']).":".$dict['value']['announce']['value'];
$dict['value']['announce']['strlen'] = strlen($dict['value']['announce']['string']);
/*if ($announce_urls[1] != "") // add multi-tracker
{
$dict['value']['announce-list']['type'] = "list";
$dict['value']['announce-list']['value'][0]['type'] = "list";
$dict['value']['announce-list']['value'][0]['value'][0]["type"] = "string";
$dict['value']['announce-list']['value'][0]['value'][0]["value"] = $ssl_torrent . $announce_urls[0] . "?passkey=$CURUSER[passkey]";
$dict['value']['announce-list']['value'][0]['value'][0]["string"] = strlen($dict['value']['announce-list']['value'][0]['value'][0]["value"]).":".$dict['value']['announce-list']['value'][0]['value'][0]["value"];
$dict['value']['announce-list']['value'][0]['value'][0]["strlen"] = strlen($dict['value']['announce-list']['value'][0]['value'][0]["string"]);
$dict['value']['announce-list']['value'][0]['string'] = "l".$dict['value']['announce-list']['value'][0]['value'][0]["string"]."e";
$dict['value']['announce-list']['value'][0]['strlen'] = strlen($dict['value']['announce-list']['value'][0]['string']);
$dict['value']['announce-list']['value'][1]['type'] = "list";
$dict['value']['announce-list']['value'][1]['value'][0]["type"] = "string";
$dict['value']['announce-list']['value'][1]['value'][0]["value"] = $ssl_torrent . $announce_urls[1] . "?passkey=$CURUSER[passkey]";
$dict['value']['announce-list']['value'][1]['value'][0]["string"] = strlen($dict['value']['announce-list']['value'][0]['value'][0]["value"]).":".$dict['value']['announce-list']['value'][0]['value'][0]["value"];
$dict['value']['announce-list']['value'][1]['value'][0]["strlen"] = strlen($dict['value']['announce-list']['value'][0]['value'][0]["string"]);
$dict['value']['announce-list']['value'][1]['string'] = "l".$dict['value']['announce-list']['value'][0]['value'][0]["string"]."e";
$dict['value']['announce-list']['value'][1]['strlen'] = strlen($dict['value']['announce-list']['value'][0]['string']);
$dict['value']['announce-list']['string'] = "l".$dict['value']['announce-list']['value'][0]['string'].$dict['value']['announce-list']['value'][1]['string']."e";
$dict['value']['announce-list']['strlen'] = strlen($dict['value']['announce-list']['string']);
}*/
/*
header ("Expires: Tue, 1 Jan 1980 00:00:00 GMT");
header ("Last-Modified: ".date("D, d M Y H:i:s"));
header ("Cache-Control: no-store, no-cache, must-revalidate");
header ("Cache-Control: post-check=0, pre-check=0", false);
header ("Pragma: no-cache");
header ("X-Powered-By: ".VERSION." (c) ".date("Y")." ".$SITENAME."");
header ("Accept-Ranges: bytes");
header ("Connection: close");
header ("Content-Transfer-Encoding: binary");
*/
header("Content-Type: application/x-bittorrent");
if ( str_replace("Gecko", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'])
{
header ("Content-Disposition: attachment; filename=\"$torrentnameprefix.".$row["save_as"].".torrent\" ; charset=utf-8");
}
else if ( str_replace("Firefox", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
{
header ("Content-Disposition: attachment; filename=\"$torrentnameprefix.".$row["save_as"].".torrent\" ; charset=utf-8");
}
else if ( str_replace("Opera", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
{
header ("Content-Disposition: attachment; filename=\"$torrentnameprefix.".$row["save_as"].".torrent\" ; charset=utf-8");
}
else if ( str_replace("IE", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
{
header ("Content-Disposition: attachment; filename=".str_replace("+", "%20", rawurlencode("$torrentnameprefix." . $row["save_as"] .".torrent")));
}
else
{
header ("Content-Disposition: attachment; filename=".str_replace("+", "%20", rawurlencode("$torrentnameprefix." . $row["save_as"] .".torrent")));
}
//header ("Content-Disposition: attachment; filename=".$row["filename"]."");
//ob_implicit_flush(true);
print(benc($dict));
?>
+164
View File
@@ -0,0 +1,164 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$torrentid = intval($_POST['id'] ?? 0);
$type = $_POST['type'];
$hidenotice = $_POST['hidenotice'];
if (!$torrentid || !in_array($type,array('firsttime', 'client', 'ratio')))
die("error");
elseif ($type == 'firsttime')
{
if ($hidenotice){
sql_query("UPDATE users SET showdlnotice=0 WHERE id=".sqlesc($CURUSER['id']));
}
header("Location: " . get_protocol_prefix() . "$BASEURL/download.php?id=".$torrentid."&letdown=1");
die;
}
elseif ($type == 'client')
{
if ($hidenotice){
sql_query("UPDATE users SET showclienterror='no' WHERE id=".sqlesc($CURUSER['id']));
}
header("Location: " . get_protocol_prefix() . "$BASEURL/download.php?id=".$torrentid."&letdown=1");
die;
}
else
{
header("Location: " . get_protocol_prefix() . "$BASEURL/download.php?id=".$torrentid."&letdown=1");
die;
}
}
else
{
$torrentid = (int)$_GET["torrentid"];
$type = $_GET["type"];
switch ($type)
{
case 'client':
{
$title = $lang_downloadnotice['text_client_banned_notice'];
$note = $lang_downloadnotice['text_client_banned_note'];
$noticenexttime = $lang_downloadnotice['text_notice_not_show_again'];
$showrationotice = false;
$showclientnotice = true;
$forcecheck = false;
break;
}
case 'ratio':
{
$title = $lang_downloadnotice['text_low_ratio_notice'];
$leechwarnuntiltime = strtotime($CURUSER['leechwarnuntil']);
if (TIMENOW < $leechwarnuntiltime){
$kicktimeout = gettime($CURUSER['leechwarnuntil'], false, false, true);
$note = $lang_downloadnotice['text_low_ratio_note_one'].$kicktimeout.$lang_downloadnotice['text_low_ratio_note_two'];
}
$noticenexttime = $lang_downloadnotice['text_notice_always_show'];
$showrationotice = true;
$showclientnotice = false;
$forcecheck = true;
break;
}
case 'firsttime':
default:
{
$type = 'firsttime';
$title = $lang_downloadnotice['text_first_time_download_notice'];
$note = $lang_downloadnotice['text_first_time_download_note'];
$noticenexttime = $lang_downloadnotice['text_notice_not_show_again'];
$showrationotice = true;
$showclientnotice = true;
$forcecheck = false;
}
}
if ($showrationotice && $showclientnotice)
$tdattr = "width=\"50%\"";
else
$tdattr = "colspan=\"2\" width=\"100%\"";
stdhead($lang_downloadnotice['head_download_notice']);
begin_main_frame();
?>
<h2><?php echo $title?></h2>
<table width="100%"><tr>
<td colspan="2" class="text" align="left"><p><?php echo $note?></p></td></tr>
<tr>
<?php
if ($showrationotice)
{
?>
<td class="text" align="left" valign="top" <?php echo $tdattr?>>
<h3><?php echo $lang_downloadnotice['text_this_is_private_tracker']?></h3>
<p><?php echo $lang_downloadnotice['text_private_tracker_note_one']?><i>(<?php echo $lang_downloadnotice['text_learn_more']?><a class="faqlink" href="<?php echo NEXUSWIKIURL?>/Private Tracker" target="_blank"><?php echo $lang_downloadnotice['text_nexuswiki']?></a>)</i></p>
<p><?php echo $lang_downloadnotice['text_private_tracker_note_two']?><i>(<?php echo $lang_downloadnotice['text_see_ratio']?><a class="faqlink" href="faq.php#id23" target="_blank"><?php echo $lang_downloadnotice['text_faq']?></a>)</i></p>
<p><?php echo $lang_downloadnotice['text_private_tracker_note_three']?></p>
<img src="pic/ratio.png" alt="ratio" />
<p><?php echo $lang_downloadnotice['text_private_tracker_note_four']?></p>
</td>
<?php
}
if ($showclientnotice)
{
?>
<td class="text" align="left" valign="top" <?php echo $tdattr?>>
<h3><?php echo $lang_downloadnotice['text_use_allowed_clients']?></h3>
<p><?php echo $lang_downloadnotice['text_allowed_clients_note_one']?><i>(<?php echo $lang_downloadnotice['text_why_banned']?><a class="faqlink" href="<?php echo NEXUSWIKIURL?>/客户端测试报告" target="_blank"><?php echo $lang_downloadnotice['text_nexuswiki']?></a>)</i></p>
<p><?php echo $lang_downloadnotice['text_allowed_clients_note_two']?><a class='faqlink' href='faq.php#id29' target='_blank'><?php echo $lang_downloadnotice['text_faq']?></a><?php echo $lang_downloadnotice['text_allowed_clients_note_three']?></p>
<table width="100%">
<tr>
<td class="embedded" style="text-align: center; padding: 5px;" width="50%">
<a href="http://www.utorrent.com/download.php" target="_blank" title="<?php echo $lang_downloadnotice['title_download']?>uTorrent"><img src="pic/utorrentbig.png" alt="uTorrent" /></a>
</td>
<td class="embedded" style="text-align: center; padding: 5px;" width="50%">
<a href="http://azureus.sourceforge.net/download.php" target="_blank" title="<?php echo $lang_downloadnotice['title_download']?>Vuze"><img src="pic/vuzebig.png" alt="Vuze" /></a>
</td>
</tr>
<tr>
<td class="embedded" style="text-align: center; padding: 5px;">
<div class="big"><a href="http://www.utorrent.com/download.php" target="_blank" title="<?php echo $lang_downloadnotice['title_download']?>uTorrent"><b>uTorrent</b></a></div>
<div><?php echo $lang_downloadnotice['text_for']?>Windows</div>
</td>
<td class="embedded" style="text-align: center; padding: 5px;">
<div class="big"><a href="http://azureus.sourceforge.net/download.php" target="_blank" title="<?php echo $lang_downloadnotice['title_download']?>Vuze"><b>Vuze</b></a></div>
<div><?php echo $lang_downloadnotice['text_for']?>Windows, Linux, Mac OS X</div>
</td>
</tr>
</table>
</td>
<?php
}
?>
</tr>
<?php
if ($torrentid)
{
?>
<tr>
<td class="text" colspan="2">
<form action="?" method="post"><p><?php echo $lang_downloadnotice['text_for_more_information_read']?><a class="faqlink" href="rules.php" target="_blank"><?php echo $lang_downloadnotice['text_rules']?></a><?php echo $lang_downloadnotice['text_and']?><a class="faqlink" href="faq.php" target="_blank"><?php echo $lang_downloadnotice['text_faq']?></a><br />
<input type="hidden" name="id" value="<?php echo $torrentid?>" />
<input type="hidden" name="type" value="<?php echo htmlspecialchars($type)?>" />
<input type="checkbox" name="hidenotice" id="hidenotice" value="1"<?php echo $forcecheck ? " disabled=\"disabled\"" : " checked=\"checked\""?> /><label for="hidenotice"><?php echo $noticenexttime?></label>
<?php
if ($forcecheck)
{
?>
<br /><input type="checkbox" name="letmedown" id="letmedown" value="<?php echo htmlspecialchars($type)?>" onclick="if (this.checked) {document.getElementById('continuedownload').disabled = false;}else{document.getElementById('continuedownload').disabled = true;}" /><label for="letmedown"><span class="big"><?php echo $lang_downloadnotice['text_let_me_download']?></span></label>
<?php
}
?>
</p>
<div><input type="submit" name="submit" id="continuedownload" style="font-size: 20pt; height: 40px;" value="<?php echo $lang_downloadnotice['submit_download_the_torrent']?>"<?php echo $forcecheck ? " disabled=\"disabled\"" : ""?> /></div>
</form>
</td>
</tr>
<?php
}
?>
</table>
<?php
end_main_frame();
stdfoot();
}
+63
View File
@@ -0,0 +1,63 @@
<?php
require "../include/bittorrent.php";
dbconn();
if (!$CURUSER)
{
Header("Location: " . get_protocol_prefix() . "$BASEURL/");
die;
}
$filename = $_GET["subid"];
$dirname = $_GET["torrentid"];
if (!$filename || !$dirname)
die("File name missing\n");
$filename = intval($filename ?? 0);
$dirname = intval($dirname ?? 0);
$res = sql_query("SELECT * FROM subs WHERE id=$filename") or sqlerr(__FILE__, __LINE__);
$arr = mysql_fetch_assoc($res);
if (!$arr)
die("Not found\n");
sql_query("UPDATE subs SET hits=hits+1 WHERE id=$filename") or sqlerr(__FILE__, __LINE__);
$file = "$SUBSPATH/$dirname/$filename.$arr[ext]";
if (!is_file($file))
die("File not found\n");
$f = fopen($file, "rb");
if (!$f)
die("Cannot open file\n");
header("Content-Length: " . filesize($file));
header("Content-Type: application/octet-stream");
if ( str_replace("Gecko", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'])
{
header ("Content-Disposition: attachment; filename=\"$arr[filename]\" ; charset=utf-8");
}
else if ( str_replace("Firefox", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
{
header ("Content-Disposition: attachment; filename=\"$arr[filename]\" ; charset=utf-8");
}
else if ( str_replace("Opera", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
{
header ("Content-Disposition: attachment; filename=\"$arr[filename]\" ; charset=utf-8");
}
else if ( str_replace("IE", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
{
header ("Content-Disposition: attachment; filename=".str_replace("+", "%20", rawurlencode($arr[filename])));
}
else
{
header ("Content-Disposition: attachment; filename=".str_replace("+", "%20", rawurlencode($arr[filename])));
}
do
{
$s = fread($f, 4096);
print($s);
} while (!feof($f));
//closefile($f);
exit;
?>
+174
View File
@@ -0,0 +1,174 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
$id = intval($_GET['id'] ?? 0);
if (!$id)
die();
$res = sql_query("SELECT torrents.*, categories.mode as cat_mode FROM torrents LEFT JOIN categories ON category = categories.id WHERE torrents.id = $id");
$row = mysql_fetch_array($res);
if (!$row) die();
if ($enablespecial == 'yes' && get_user_class() >= $movetorrent_class)
$allowmove = true; //enable moving torrent to other section
else $allowmove = false;
$sectionmode = $row['cat_mode'];
if ($sectionmode == $browsecatmode)
{
$othermode = $specialcatmode;
$movenote = $lang_edit['text_move_to_special'];
}
else
{
$othermode = $browsecatmode;
$movenote = $lang_edit['text_move_to_browse'];
}
$showsource = (get_searchbox_value($sectionmode, 'showsource') || ($allowmove && get_searchbox_value($othermode, 'showsource'))); //whether show sources or not
$showmedium = (get_searchbox_value($sectionmode, 'showmedium') || ($allowmove && get_searchbox_value($othermode, 'showmedium'))); //whether show media or not
$showcodec = (get_searchbox_value($sectionmode, 'showcodec') || ($allowmove && get_searchbox_value($othermode, 'showcodec'))); //whether show codecs or not
$showstandard = (get_searchbox_value($sectionmode, 'showstandard') || ($allowmove && get_searchbox_value($othermode, 'showstandard'))); //whether show standards or not
$showprocessing = (get_searchbox_value($sectionmode, 'showprocessing') || ($allowmove && get_searchbox_value($othermode, 'showprocessing'))); //whether show processings or not
$showteam = (get_searchbox_value($sectionmode, 'showteam') || ($allowmove && get_searchbox_value($othermode, 'showteam'))); //whether show teams or not
$showaudiocodec = (get_searchbox_value($sectionmode, 'showaudiocodec') || ($allowmove && get_searchbox_value($othermode, 'showaudiocodec'))); //whether show audio codecs or not
stdhead($lang_edit['head_edit_torrent'] . "\"". $row["name"] . "\"");
if (!isset($CURUSER) || ($CURUSER["id"] != $row["owner"] && get_user_class() < $torrentmanage_class)) {
print("<h1 align=\"center\">".$lang_edit['text_cannot_edit_torrent']."</h1>");
print("<p>".$lang_edit['text_cannot_edit_torrent_note']."</p>");
}
else {
print("<form method=\"post\" id=\"compose\" name=\"edittorrent\" action=\"takeedit.php\" enctype=\"multipart/form-data\">");
print("<input type=\"hidden\" name=\"id\" value=\"$id\" />");
if (isset($_GET["returnto"]))
print("<input type=\"hidden\" name=\"returnto\" value=\"" . htmlspecialchars($_GET["returnto"]) . "\" />");
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" width=\"940\">\n");
print("<tr><td class='colhead' colspan='2' align='center'>".htmlspecialchars($row["name"])."</td></tr>");
tr($lang_edit['row_torrent_name']."<font color=\"red\">*</font>", "<input type=\"text\" style=\"width: 650px;\" name=\"name\" value=\"" . htmlspecialchars($row["name"]) . "\" />", 1);
if ($smalldescription_main == 'yes')
tr($lang_edit['row_small_description'], "<input type=\"text\" style=\"width: 650px;\" name=\"small_descr\" value=\"" . htmlspecialchars($row["small_descr"]) . "\" />", 1);
get_external_tr($row["url"]);
if ($enablenfo_main=='yes')
tr($lang_edit['row_nfo_file'], "<font class=\"medium\"><input type=\"radio\" name=\"nfoaction\" value=\"keep\" checked=\"checked\" />".$lang_edit['radio_keep_current'].
"<input type=\"radio\" name=\"nfoaction\" value=\"remove\" />".$lang_edit['radio_remove'].
"<input id=\"nfoupdate\" type=\"radio\" name=\"nfoaction\" value=\"update\" />".$lang_edit['radio_update']."</font><br /><input type=\"file\" name=\"nfo\" onchange=\"document.getElementById('nfoupdate').checked=true\" />", 1);
print("<tr><td class=\"rowhead\">".$lang_edit['row_description']."<font color=\"red\">*</font></td><td class=\"rowfollow\">");
textbbcode("edittorrent","descr",($row["descr"]), false);
print("</td></tr>");
$s = "<select name=\"type\" id=\"oricat\">";
$cats = genrelist($sectionmode);
foreach ($cats as $subrow) {
$s .= "<option value=\"" . $subrow["id"] . "\"";
if ($subrow["id"] == $row["category"])
$s .= " selected=\"selected\"";
$s .= ">" . htmlspecialchars($subrow["name"]) . "</option>\n";
}
$s .= "</select>\n";
if ($allowmove){
$s2 = "<select name=\"type\" id=newcat disabled>\n";
$cats2 = genrelist($othermode);
foreach ($cats2 as $subrow) {
$s2 .= "<option value=\"" . $subrow["id"] . "\"";
if ($subrow["id"] == $row["category"])
$s2 .= " selected=\"selected\"";
$s2 .= ">" . htmlspecialchars($subrow["name"]) . "</option>\n";
}
$s2 .= "</select>\n";
$movecheckbox = "<input type=\"checkbox\" id=movecheck name=\"movecheck\" value=\"1\" onclick=\"disableother2('oricat','newcat')\" />";
}
tr($lang_edit['row_type']."<font color=\"red\">*</font>", $s.($allowmove ? "&nbsp;&nbsp;".$movecheckbox.$movenote.$s2 : ""), 1);
if ($showsource || $showmedium || $showcodec || $showaudiocodec || $showstandard || $showprocessing){
if ($showsource){
$source_select = torrent_selection($lang_edit['text_source'],"source_sel","sources",$row["source"]);
}
else $source_select = "";
if ($showmedium){
$medium_select = torrent_selection($lang_edit['text_medium'],"medium_sel","media",$row["medium"]);
}
else $medium_select = "";
if ($showcodec){
$codec_select = torrent_selection($lang_edit['text_codec'],"codec_sel","codecs",$row["codec"]);
}
else $codec_select = "";
if ($showaudiocodec){
$audiocodec_select = torrent_selection($lang_edit['text_audio_codec'],"audiocodec_sel","audiocodecs",$row["audiocodec"]);
}
else $audiocodec_select = "";
if ($showstandard){
$standard_select = torrent_selection($lang_edit['text_standard'],"standard_sel","standards",$row["standard"]);
}
else $standard_select = "";
if ($showprocessing){
$processing_select = torrent_selection($lang_edit['text_processing'],"processing_sel","processings",$row["processing"]);
}
else $processing_select = "";
tr($lang_edit['row_quality'], $source_select . $medium_select . $codec_select . $audiocodec_select. $standard_select . $processing_select, 1);
}
if ($showteam){
if ($showteam){
$team_select = torrent_selection($lang_edit['text_team'],"team_sel","teams",$row["team"]);
}
else $showteam = "";
tr($lang_edit['row_content'],$team_select,1);
}
tr($lang_edit['row_check'], "<input type=\"checkbox\" name=\"visible\"" . ($row["visible"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" /> ".$lang_edit['checkbox_visible']."&nbsp;&nbsp;&nbsp;".(get_user_class() >= $beanonymous_class || get_user_class() >= $torrentmanage_class ? "<input type=\"checkbox\" name=\"anonymous\"" . ($row["anonymous"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" />".$lang_edit['checkbox_anonymous_note']."&nbsp;&nbsp;&nbsp;" : "").(get_user_class() >= $torrentmanage_class ? "<input type=\"checkbox\" name=\"banned\"" . (($row["banned"] == "yes") ? " checked=\"checked\"" : "" ) . " value=\"yes\" /> ".$lang_edit['checkbox_banned'] : ""), 1);
if (get_user_class()>= $torrentsticky_class || (get_user_class() >= $torrentmanage_class && $CURUSER["picker"] == 'yes')){
$pickcontent = "";
if(get_user_class()>=$torrentsticky_class)
{
$pickcontent .= "<b>".$lang_edit['row_special_torrent'].":&nbsp;</b>"."<select name=\"sel_spstate\" style=\"width: 100px;\">" .promotion_selection($row["sp_state"], 0). "</select>&nbsp;&nbsp;&nbsp;";
$pickcontent .= "<b>".$lang_edit['row_torrent_position'].":&nbsp;</b>"."<select name=\"sel_posstate\" style=\"width: 100px;\">" .
"<option" . (($row["pos_state"] == "normal") ? " selected=\"selected\"" : "" ) . " value=\"0\">".$lang_edit['select_normal']."</option>" .
"<option" . (($row["pos_state"] == "sticky") ? " selected=\"selected\"" : "" ) . " value=\"1\">".$lang_edit['select_sticky']."</option>" .
"</select>&nbsp;&nbsp;&nbsp;";
}
if(get_user_class()>=$torrentmanage_class && $CURUSER["picker"] == 'yes')
{
$pickcontent .= "<b>".$lang_edit['row_recommended_movie'].":&nbsp;</b>"."<select name=\"sel_recmovie\" style=\"width: 100px;\">" .
"<option" . (($row["picktype"] == "normal") ? " selected=\"selected\"" : "" ) . " value=\"0\">".$lang_edit['select_normal']."</option>" .
"<option" . (($row["picktype"] == "hot") ? " selected=\"selected\"" : "" ) . " value=\"1\">".$lang_edit['select_hot']."</option>" .
"<option" . (($row["picktype"] == "classic") ? " selected=\"selected\"" : "" ) . " value=\"2\">".$lang_edit['select_classic']."</option>" .
"<option" . (($row["picktype"] == "recommended") ? " selected=\"selected\"" : "" ) . " value=\"3\">".$lang_edit['select_recommended']."</option>" .
"</select>";
}
tr($lang_edit['row_pick'], $pickcontent, 1);
}
print("<tr><td class=\"toolbox\" colspan=\"2\" align=\"center\"><input id=\"qr\" type=\"submit\" value=\"".$lang_edit['submit_edit_it']."\" /> <input type=\"reset\" value=\"".$lang_edit['submit_revert_changes']."\" /></td></tr>\n");
print("</table>\n");
print("</form>\n");
print("<br /><br />");
print("<form method=\"post\" action=\"delete.php\">\n");
print("<input type=\"hidden\" name=\"id\" value=\"$id\" />\n");
if (isset($_GET["returnto"]))
print("<input type=\"hidden\" name=\"returnto\" value=\"" . htmlspecialchars($_GET["returnto"]) . "\" />\n");
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n");
print("<tr><td class=\"colhead\" align=\"left\" style='padding-bottom: 3px' colspan=\"2\">".$lang_edit['text_delete_torrent']."</td></tr>");
tr("<input name=\"reasontype\" type=\"radio\" value=\"1\" />&nbsp;".$lang_edit['radio_dead'], $lang_edit['text_dead_note'], 1);
tr("<input name=\"reasontype\" type=\"radio\" value=\"2\" />&nbsp;".$lang_edit['radio_dupe'], "<input type=\"text\" style=\"width: 200px\" name=\"reason[]\" />", 1);
tr("<input name=\"reasontype\" type=\"radio\" value=\"3\" />&nbsp;".$lang_edit['radio_nuked'], "<input type=\"text\" style=\"width: 200px\" name=\"reason[]\" />", 1);
tr("<input name=\"reasontype\" type=\"radio\" value=\"4\" />&nbsp;".$lang_edit['radio_rules'], "<input type=\"text\" style=\"width: 200px\" name=\"reason[]\" />".$lang_edit['text_req'], 1);
tr("<input name=\"reasontype\" type=\"radio\" value=\"5\" checked=\"checked\" />&nbsp;".$lang_edit['radio_other'], "<input type=\"text\" style=\"width: 200px\" name=\"reason[]\" />".$lang_edit['text_req'], 1);
print("<tr><td class=\"toolbox\" colspan=\"2\" align=\"center\"><input type=\"submit\" style='height: 25px' value=\"".$lang_edit['submit_delete_it']."\" /></td></tr>\n");
print("</table>");
print("</form>\n");
}
stdfoot();
+67
View File
@@ -0,0 +1,67 @@
<?php
require "../include/bittorrent.php";
dbconn();
$id = intval($_GET["id"] ?? 0);
int_check($id,true);
$res = sql_query("SELECT username, class, email FROM users WHERE id=".mysql_real_escape_string($id));
$arr = mysql_fetch_assoc($res) or stderr("Error", "No such user.");
$username = $arr["username"];
if ($arr["class"] < UC_MODERATOR)
stderr("Error", "The gateway can only be used to e-mail staff members.");
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$to = $arr["email"];
$from = substr(htmlspecialchars(trim($_POST["from"])), 0, 80);
if ($from == "") $from = "Anonymous";
$from_email = substr(htmlspecialchars(trim($_POST["from_email"])), 0, 80);
if ($from_email == "") $from_email = "".$SITEEMAIL."";
$from_email = safe_email($from_email);
if (!$from_email)
stderr("Error","You must enter an email address!");
if (!check_email($from_email))
stderr("Error","Invalid email address!");
$from = "$from <$from_email>";
$subject = substr(htmlspecialchars(trim($_POST["subject"])), 0, 80);
if ($subject == "") $subject = "(No subject)";
$subject = "Fw: $subject";
$message = htmlspecialchars(trim($_POST["message"]));
if ($message == "") stderr("Error", "No message text!");
$message = "Message submitted from ".getip()." at " . date("Y-m-d H:i:s") . ".\n" .
"Note: By replying to this e-mail you will reveal your e-mail address.\n" .
"---------------------------------------------------------------------\n\n" .
$message . "\n\n" .
"---------------------------------------------------------------------\n$SITENAME E-Mail Gateway\n";
$success = sent_mail($to,$from,$from_email,$subject,$message,"E-Mail Gateway",false);
if ($success)
stderr("Success", "E-mail successfully queued for delivery.");
else
stderr("Error", "The mail could not be sent. Please try again later.");
}
stdhead("E-mail gateway");
?>
<p><table border=0 class=main cellspacing=0 cellpadding=0><tr>
<td class=embedded style='padding-left: 10px'><font size=3><b>Send e-mail to <?php echo $username;?></b></font></td>
</tr></table></p>
<table border=1 cellspacing=0 cellpadding=5>
<form method=post action=email-gateway.php?id=<?php echo $id?>>
<tr><td class=rowhead>Your name</td><td><input type=text name=from size=80></td></tr>
<tr><td class=rowhead>Your e-mail</td><td><input type=text name=from_email size=80></td></tr>
<tr><td class=rowhead>Subject</td><td><input type=text name=subject size=80></td></tr>
<tr><td class=rowhead>Message</td><td><textarea name=message cols=80 rows=20></textarea></td></tr>
<tr><td colspan=2 align=center><input type=submit value="Send" class=btn></td></tr>
</form>
</table>
<p>
<font class=small><b>Note:</b> Your IP-address will be logged and visible to the recipient to prevent abuse.<br />
Make sure to supply a valid e-mail address if you expect a reply.</font>
</p>
<?php stdfoot();
+180
View File
@@ -0,0 +1,180 @@
/** $Id$ */
// Title: Fadomatic
// Version: 1.2
// Homepage: http://chimpen.com/fadomatic
// Author: Philip McCarthy <fadomatic@chimpen.com>
// Fade interval in milliseconds
// Make this larger if you experience performance issues
Fadomatic.INTERVAL_MILLIS = 50;
// Creates a fader
// element - The element to fade
// speed - The speed to fade at, from 0.0 to 100.0
// initialOpacity (optional, default 100) - element's starting opacity, 0 to 100
// minOpacity (optional, default 0) - element's minimum opacity, 0 to 100
// maxOpacity (optional, default 0) - element's minimum opacity, 0 to 100
function Fadomatic (element, rate, initialOpacity, minOpacity, maxOpacity) {
this._element = element;
this._intervalId = null;
this._rate = rate;
this._isFadeOut = true;
// Set initial opacity and bounds
// NB use 99 instead of 100 to avoid flicker at start of fade
this._minOpacity = 0;
this._maxOpacity = 99;
this._opacity = 99;
if (typeof minOpacity != 'undefined') {
if (minOpacity < 0) {
this._minOpacity = 0;
} else if (minOpacity > 99) {
this._minOpacity = 99;
} else {
this._minOpacity = minOpacity;
}
}
if (typeof maxOpacity != 'undefined') {
if (maxOpacity < 0) {
this._maxOpacity = 0;
} else if (maxOpacity > 99) {
this._maxOpacity = 99;
} else {
this._maxOpacity = maxOpacity;
}
if (this._maxOpacity < this._minOpacity) {
this._maxOpacity = this._minOpacity;
}
}
if (typeof initialOpacity != 'undefined') {
if (initialOpacity > this._maxOpacity) {
this._opacity = this._maxOpacity;
} else if (initialOpacity < this._minOpacity) {
this._opacity = this._minOpacity;
} else {
this._opacity = initialOpacity;
}
}
// See if we're using W3C opacity, MSIE filter, or just
// toggling visiblity
if(typeof element.style.opacity != 'undefined') {
this._updateOpacity = this._updateOpacityW3c;
} else if(typeof element.style.filter != 'undefined') {
// If there's not an alpha filter on the element already,
// add one
if (element.style.filter.indexOf("alpha") == -1) {
// Attempt to preserve existing filters
var existingFilters="";
if (element.style.filter) {
existingFilters = element.style.filter+" ";
}
element.style.filter = existingFilters+"alpha(opacity="+this._opacity+")";
}
this._updateOpacity = this._updateOpacityMSIE;
} else {
this._updateOpacity = this._updateVisibility;
}
this._updateOpacity();
}
// Initiates a fade out
Fadomatic.prototype.fadeOut = function () {
this._isFadeOut = true;
this._beginFade();
}
// Initiates a fade in
Fadomatic.prototype.fadeIn = function () {
this._isFadeOut = false;
this._beginFade();
}
// Makes the element completely opaque, stops any fade in progress
Fadomatic.prototype.show = function () {
this.haltFade();
this._opacity = this._maxOpacity;
this._updateOpacity();
}
// Makes the element completely transparent, stops any fade in progress
Fadomatic.prototype.hide = function () {
this.haltFade();
this._opacity = 0;
this._updateOpacity();
}
// Halts any fade in progress
Fadomatic.prototype.haltFade = function () {
clearInterval(this._intervalId);
}
// Resumes a fade where it was halted
Fadomatic.prototype.resumeFade = function () {
this._beginFade();
}
// Pseudo-private members
Fadomatic.prototype._beginFade = function () {
this.haltFade();
var objref = this;
this._intervalId = setInterval(function() { objref._tickFade(); },Fadomatic.INTERVAL_MILLIS);
}
Fadomatic.prototype._tickFade = function () {
if (this._isFadeOut) {
this._opacity -= this._rate;
if (this._opacity < this._minOpacity) {
this._opacity = this._minOpacity;
this.haltFade();
}
} else {
this._opacity += this._rate;
if (this._opacity > this._maxOpacity ) {
this._opacity = this._maxOpacity;
this.haltFade();
}
}
this._updateOpacity();
}
Fadomatic.prototype._updateVisibility = function () {
if (this._opacity > 0) {
this._element.style.visibility = 'visible';
} else {
this._element.style.visibility = 'hidden';
}
}
Fadomatic.prototype._updateOpacityW3c = function () {
this._element.style.opacity = this._opacity/100;
this._updateVisibility();
}
Fadomatic.prototype._updateOpacityMSIE = function () {
this._element.filters.alpha.opacity = this._opacity;
this._updateVisibility();
}
Fadomatic.prototype._updateOpacity = null;
+106
View File
@@ -0,0 +1,106 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
stdhead($lang_faq['head_faq']);
$Cache->new_page('faq', 900, true);
if (!$Cache->get_page())
{
$Cache->add_whole_row();
//make_folder("cache/" , get_langfolder_cookie());
//cache_check ('faq');
begin_main_frame();
begin_frame($lang_faq['text_welcome_to'].$SITENAME." - ".$SLOGAN);
print($lang_faq['text_welcome_content_one'].$lang_faq['text_welcome_content_two']);
end_frame();
$lang_id = get_guest_lang_id();
$is_rulelang = get_single_value("language","rule_lang","WHERE id = ".sqlesc($lang_id));
if (!$is_rulelang){
$lang_id = 6; //English
}
$res = sql_query("SELECT `id`, `link_id`, `question`, `flag` FROM `faq` WHERE `type`='categ' AND `lang_id` = ".sqlesc($lang_id)." ORDER BY `order` ASC");
while ($arr = mysql_fetch_array($res)) {
$faq_categ[$arr['link_id']]['title'] = $arr['question'];
$faq_categ[$arr['link_id']]['flag'] = $arr['flag'];
$faq_categ[$arr['link_id']]['link_id'] = $arr['link_id'];
}
$res = sql_query("SELECT `id`, `link_id`, `question`, `answer`, `flag`, `categ` FROM `faq` WHERE `type`='item' AND `lang_id` = ".sqlesc($lang_id)." ORDER BY `order` ASC");
while ($arr = mysql_fetch_array($res)) {
$faq_categ[$arr['categ']]['items'][$arr['id']]['question'] = $arr['question'];
$faq_categ[$arr['categ']]['items'][$arr['id']]['answer'] = $arr['answer'];
$faq_categ[$arr['categ']]['items'][$arr['id']]['flag'] = $arr['flag'];
$faq_categ[$arr['categ']]['items'][$arr['id']]['link_id'] = $arr['link_id'];
}
if (isset($faq_categ)) {
// gather orphaned items
/*
foreach ($faq_categ as $id => $temp)
{
if (!array_key_exists("title", $faq_categ[$id]))
{
foreach ($faq_categ[$id]['items'] as $id2 => $temp)
{
$faq_orphaned[$id2]['question'] = $faq_categ[$id]['items'][$id2]['question'];
$faq_orphaned[$id2][answer] = $faq_categ[$id]['items'][$id2][answer];
$faq_orphaned[$id2]['flag'] = $faq_categ[$id]['items'][$id2]['flag'];
unset($faq_categ[$id]);
}
}
}
*/
begin_frame("<span id=\"top\">".$lang_faq['text_contents'] . "</span>");
foreach ($faq_categ as $id => $temp)
{
if ($faq_categ[$id]['flag'] == "1")
{
print("<ul><li><a href=\"#id". $faq_categ[$id]['link_id'] ."\"><b>". $faq_categ[$id]['title'] ."</b></a><ul>\n");
if (array_key_exists("items", $faq_categ[$id]))
{
foreach ($faq_categ[$id]['items'] as $id2 => $temp)
{
if ($faq_categ[$id]['items'][$id2]['flag'] == "1") print("<li><a href=\"#id". $faq_categ[$id]['items'][$id2]['link_id'] ."\" class=\"faqlink\">". $faq_categ[$id]['items'][$id2]['question'] ."</a></li>\n");
elseif ($faq_categ[$id]['items'][$id2]['flag'] == "2") print("<li><a href=\"#id". $faq_categ[$id]['items'][$id2]['link_id'] ."\" class=\"faqlink\">". $faq_categ[$id]['items'][$id2]['question'] ."</a> <img class=\"faq_updated\" src=\"pic/trans.gif\" alt=\"Updated\" /></li>\n");
elseif ($faq_categ[$id]['items'][$id2]['flag'] == "3") print("<li><a href=\"#id". $faq_categ[$id]['items'][$id2]['link_id'] ."\" class=\"faqlink\">". $faq_categ[$id]['items'][$id2]['question'] ."</a> <img class=\"faq_new\" src=\"pic/trans.gif\" alt=\"New\" /></li>\n");
}
}
print("</ul></li></ul><br />");
}
}
end_frame();
foreach ($faq_categ as $id => $temp) {
if ($faq_categ[$id]['flag'] == "1")
{
$frame = $faq_categ[$id]['title'] ." - <a href=\"#top\"><img class=\"top\" src=\"pic/trans.gif\" alt=\"Top\" title=\"Top\" /></a>";
begin_frame($frame);
print("<span id=\"id". $faq_categ[$id]['link_id'] ."\"></span>");
if (array_key_exists("items", $faq_categ[$id]))
{
foreach ($faq_categ[$id]['items'] as $id2 => $temp)
{
if ($faq_categ[$id]['items'][$id2]['flag'] != "0")
{
print("<br /><span id=\"id".$faq_categ[$id]['items'][$id2]['link_id']."\"><b>". $faq_categ[$id]['items'][$id2]['question'] ."</b></span><br />\n");
print("<br />". $faq_categ[$id]['items'][$id2]['answer'] ."\n<br /><br />\n");
}
}
}
end_frame();
}
}
}
end_main_frame();
$Cache->end_whole_row();
$Cache->cache_page();
}
echo $Cache->next_row();
//cache_save ('faq');
stdfoot();
?>
+197
View File
@@ -0,0 +1,197 @@
<?php
/*
+--------------------------------------------------------------------------
| MySQL driven FAQ version 1.1 Beta
| ========================================
| by avataru
| (c) 2002 - 2005 avataru
| http://www.avataru.net
| ========================================
| Web: http://www.avataru.net
| Release: 1/9/2005 1:03 AM
| Email: avataru@avataru.net
| Tracker: http://www.sharereactor.ro
+---------------------------------------------------------------------------
|
| > FAQ Management actions
| > Written by avataru
| > Date started: 1/7/2005
|
+--------------------------------------------------------------------------
*/
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_ADMINISTRATOR) {
stderr("Error","Only Administrators and above can modify the FAQ, sorry.");
}
//stdhead("FAQ Management");
// ACTION: reorder - reorder sections and items
if (isset($_GET['action']) && $_GET['action'] == "reorder") {
foreach($_POST[order] as $id => $position) sql_query("UPDATE `faq` SET `order`=".sqlesc($position)." WHERE id=".sqlesc($id)) or sqlerr();
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
die;
}
// ACTION: edit - edit a section or item
elseif (isset($_GET['action']) && $_GET['action'] == "edit" && isset($_GET['id'])) {
stdhead("FAQ Management");
begin_main_frame();
print("<h1 align=\"center\">Edit Section or Item</h1>");
$res = sql_query("SELECT * FROM faq WHERE id=".sqlesc($_GET['id'])." LIMIT 1");
while ($arr = mysql_fetch_array($res, MYSQLI_BOTH)) {
$arr['question'] = htmlspecialchars($arr['question']);
$arr['answer'] = htmlspecialchars($arr['answer']);
if ($arr['type'] == "item") {
$lang_id = $arr['lang_id'];
print("<form method=\"post\" action=\"faqactions.php?action=edititem\">");
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"10\" align=\"center\">\n");
print("<tr><td>ID:</td><td>{$arr['id']} <input type=\"hidden\" name=\"id\" value=\"{$arr['id']}\" /></td></tr>\n");
print("<tr><td>Question:</td><td><input style=\"width: 600px;\" type=\"text\" name=\"question\" value=\"{$arr['question']}\" /></td></tr>\n");
print("<tr><td style=\"vertical-align: top;\">Answer:</td><td><textarea rows=20 style=\"width: 600px; height=600px;\" name=\"answer\">{$arr['answer']}</textarea></td></tr>\n");
if ($arr['flag'] == "0") print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\" selected=\"selected\">Hidden</option><option value=\"1\" style=\"color: #000000;\">Normal</option><option value=\"2\" style=\"color: #0000FF;\">Updated</option><option value=\"3\" style=\"color: #008000;\">New</option></select></td></tr>");
elseif ($arr['flag'] == "2") print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\">Hidden</option><option value=\"1\" style=\"color: #000000;\">Normal</option><option value=\"2\" style=\"color: #0000FF;\" selected=\"selected\">Updated</option><option value=\"3\" style=\"color: #008000;\">New</option></select></td></tr>");
elseif ($arr['flag'] == "3") print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\">Hidden</option><option value=\"1\" style=\"color: #000000;\">Normal</option><option value=\"2\" style=\"color: #0000FF;\">Updated</option><option value=\"3\" style=\"color: #008000;\" selected=\"selected\">New</option></select></td></tr>");
else print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\">Hidden</option><option value=\"1\" style=\"color: #000000;\" selected=\"selected\">Normal</option><option value=\"2\" style=\"color: #0000FF;\">Updated</option><option value=\"3\" style=\"color: #008000;\">New</option></select></td></tr>");
print("<tr><td>Category:</td><td><select style=\"width: 400px;\" name=\"categ\" />");
$res2 = sql_query("SELECT `id`, `question`, `link_id` FROM `faq` WHERE `type`='categ' AND `lang_id` = ".sqlesc($lang_id)." ORDER BY `order` ASC");
while ($arr2 = mysql_fetch_array($res2, MYSQLI_BOTH)) {
$selected = ($arr2['link_id'] == $arr[categ]) ? " selected=\"selected\"" : "";
print("<option value=\"{$arr2['link_id']}\"". $selected .">{$arr2['question']}</option>");
}
print("</td></tr>\n");
print("<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"edit\" value=\"Edit\" style=\"width: 60px;\"></td></tr>\n");
print("</table>");
}
elseif ($arr['type'] == "categ") {
$lang_res = sql_query("SELECT lang_name FROM language WHERE id=".sqlesc($arr['lang_id'])." LIMIT 1");
if ($lang_arr = mysql_fetch_array($lang_res))
$lang_name = $lang_arr['lang_name'];
print("<form method=\"post\" action=\"faqactions.php?action=editsect\">");
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"10\" align=\"center\">\n");
print("<tr><td>ID:</td><td>{$arr['id']} <input type=\"hidden\" name=\"id\" value=\"{$arr['id']}\" /></td></tr>\n");
print("<tr><td>Language:</td><td>$lang_name</td></tr>\n");
print("<tr><td>Title:</td><td><input style=\"width: 300px;\" type=\"text\" name=\"title\" value=\"{$arr['question']}\" /></td></tr>\n");
if ($arr['flag'] == "0") print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\" selected=\"selected\">Hidden</option><option value=\"1\" style=\"color: #000000;\">Normal</option></select></td></tr>");
else print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\">Hidden</option><option value=\"1\" style=\"color: #000000;\" selected=\"selected\">Normal</option></select></td></tr>");
print("<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"edit\" value=\"Edit\" style=\"width: 60px;\"></td></tr>\n");
print("</table>");
}
}
end_main_frame();
stdfoot();
}
// subACTION: edititem - edit an item
elseif (isset($_GET['action']) && $_GET['action'] == "edititem" && $_POST['id'] != NULL && $_POST['question'] != NULL && $_POST['answer'] != NULL && $_POST['flag'] != NULL && $_POST[categ] != NULL) {
$question = $_POST['question'];
$answer = $_POST['answer'];
sql_query("UPDATE `faq` SET `question`=".sqlesc($question).", `answer`=".sqlesc($answer).", `flag`=".sqlesc($_POST['flag']).", `categ`=".sqlesc($_POST[categ])." WHERE id=".sqlesc($_POST['id'])) or sqlerr();
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
die;
}
// subACTION: editsect - edit a section
elseif (isset($_GET['action']) && $_GET['action'] == "editsect" && $_POST['id'] != NULL && $_POST['title'] != NULL && $_POST['flag'] != NULL) {
$title = $_POST['title'];
sql_query("UPDATE `faq` SET `question`=".sqlesc($title).", `answer`='', `flag`=".sqlesc($_POST['flag']).", `categ`='0' WHERE id=".sqlesc($_POST['id'])) or sqlerr();
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
die;
}
// ACTION: delete - delete a section or item
elseif (isset($_GET['action']) && $_GET['action'] == "delete" && isset($_GET['id'])) {
if ($_GET[confirm] == "yes") {
sql_query("DELETE FROM `faq` WHERE `id`=".sqlesc(intval($_GET['id'] ?? 0))." LIMIT 1") or sqlerr();
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
die;
}
else {
stdhead("FAQ Management");
begin_main_frame();
print("<h1 align=\"center\">Confirmation required</h1>");
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\" width=\"95%\">\n<tr><td align=\"center\">Please click <a href=\"faqactions.php?action=delete&id={$_GET['id']}&confirm=yes\">here</a> to confirm.</td></tr>\n</table>\n");
end_main_frame();
stdfoot();
}
}
// ACTION: additem - add a new item
elseif (isset($_GET['action']) && $_GET['action'] == "additem" && $_GET['inid'] && $_GET['langid']) {
stdhead("FAQ Management");
begin_main_frame();
print("<h1 align=\"center\">Add Item</h1>");
print("<form method=\"post\" action=\"faqactions.php?action=addnewitem\">");
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"10\" align=\"center\">\n");
print("<tr><td>Question:</td><td><input style=\"width: 600px;\" type=\"text\" name=\"question\" value=\"\" /></td></tr>\n");
print("<tr><td style=\"vertical-align: top;\">Answer:</td><td><textarea rows=20 style=\"width: 600px; height=600px;\" name=\"answer\"></textarea></td></tr>\n");
print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\">Hidden</option><option value=\"1\" style=\"color: #000000;\">Normal</option><option value=\"2\" style=\"color: #0000FF;\">Updated</option><option value=\"3\" style=\"color: #008000;\" selected=\"selected\">New</option></select></td></tr>");
print("<input type=hidden name=categ value=\"".(intval($_GET['inid'] ?? 0))."\">");
print("<input type=hidden name=langid value=\"".(intval($_GET['langid'] ?? 0))."\">");
print("<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Add\" style=\"width: 60px;\"></td></tr>\n");
print("</table></form>");
end_main_frame();
stdfoot();
}
// ACTION: addsection - add a new section
elseif (isset($_GET['action']) && $_GET['action'] == "addsection") {
stdhead("FAQ Management");
begin_main_frame();
print("<h1 align=\"center\">Add Section</h1>");
print("<form method=\"post\" action=\"faqactions.php?action=addnewsect\">");
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"10\" align=\"center\">\n");
print("<tr><td>Title:</td><td><input style=\"width: 300px;\" type=\"text\" name=\"title\" value=\"\" /></td></tr>\n");
$s = "<select name=language>";
$langs = langlist("rule_lang");
foreach ($langs as $row)
{
if($row["site_lang_folder"] == $deflang) $se = " selected"; else $se = "";
$s .= "<option value=". $row["id"] . $se. ">" . htmlspecialchars($row["lang_name"]) . "</option>\n";
}
$s .= "</select>";
print("<tr><td>Language:</td><td>".$s."</td></tr>");
print("<tr><td>Status:</td><td><select name=\"flag\" style=\"width: 110px;\"><option value=\"0\" style=\"color: #FF0000;\">Hidden</option><option value=\"1\" style=\"color: #000000;\" selected=\"selected\">Normal</option></select></td></tr>");
print("<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"edit\" value=\"Add\" style=\"width: 60px;\"></td></tr>\n");
print("</table>");
end_main_frame();
stdfoot();
}
// subACTION: addnewitem - add a new item to the db
elseif (isset($_GET['action']) && $_GET['action'] == "addnewitem" && $_POST['question'] != NULL && $_POST['answer'] != NULL) {
$question = $_POST['question'];
$answer = $_POST['answer'];
$categ = intval($_POST[categ] ?? 0);
$langid = intval($_POST['langid'] ?? 0);
$res = sql_query("SELECT MAX(`order`) AS maxorder, MAX(`link_id`) AS maxlinkid FROM `faq` WHERE `type`='item' AND `categ`=".sqlesc($categ)." AND lang_id=".sqlesc($langid));
while ($arr = mysql_fetch_array($res, MYSQLI_BOTH))
{
$order = $arr['maxorder'] + 1;
$link_id = $arr['maxlinkid']+1;
}
sql_query("INSERT INTO `faq` (`link_id`, `type`, `lang_id`, `question`, `answer`, `flag`, `categ`, `order`) VALUES ('$link_id', 'item', ".sqlesc($langid).", ".sqlesc($question).", ".sqlesc($answer).", " . sqlesc(intval($_POST['flag'] ?? 0)) . ", ".sqlesc($categ).", ".sqlesc($order).")") or sqlerr();
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
die;
}
// subACTION: addnewsect - add a new section to the db
elseif (isset($_GET['action']) && $_GET['action'] == "addnewsect" && $_POST['title'] != NULL && $_POST['flag'] != NULL) {
$title = $_POST['title'];
$language = intval($_POST['language'] ?? 0);
$res = sql_query("SELECT MAX(`order`) AS maxorder, MAX(`link_id`) AS maxlinkid FROM `faq` WHERE `type`='categ' AND `lang_id` = ".sqlesc($language));
while ($arr = mysql_fetch_array($res, MYSQLI_BOTH)) {$order = $arr['maxorder'] + 1;$link_id = $arr['maxlinkid']+1;}
sql_query("INSERT INTO `faq` (`link_id`,`type`,`lang_id`, `question`, `answer`, `flag`, `categ`, `order`) VALUES (".sqlesc($link_id).",'categ', ".sqlesc($language).", ".sqlesc($title).", '', ".sqlesc($_POST['flag']).", '0', ".sqlesc($order).")") or sqlerr();
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
die;
} else {
header("Location: " . get_protocol_prefix() . "$BASEURL/faqmanage.php");
die;
}
?>
+118
View File
@@ -0,0 +1,118 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_ADMINISTRATOR) {
permissiondenied();
}
stdhead("FAQ Management");
begin_main_frame();
print("<h1 align=\"center\">FAQ Management</h1>");
// make the array that has all the faq in a nice structured
$res = sql_query("SELECT faq.id, faq.link_id, faq.lang_id, lang_name, faq.question, faq.flag, faq.order FROM faq LEFT JOIN language on faq.lang_id = language.id WHERE type='categ' ORDER BY lang_name, `order` ASC");
while ($arr = mysql_fetch_array($res, MYSQLI_BOTH)) {
$faq_categ[$arr['lang_id']][$arr['link_id']]['title'] = $arr['question'];
$faq_categ[$arr['lang_id']][$arr['link_id']]['flag'] = $arr['flag'];
$faq_categ[$arr['lang_id']][$arr['link_id']]['order'] = $arr['order'];
$faq_categ[$arr['lang_id']][$arr['link_id']]['id'] = $arr['id'];
$faq_categ[$arr['lang_id']][$arr['link_id']]['lang_name'] = $arr['lang_name'];
}
$res = sql_query("SELECT faq.id, faq.question, faq.lang_id, faq.flag, faq.categ, faq.order FROM faq WHERE type='item' ORDER BY `order` ASC");
while ($arr = mysql_fetch_array($res)) {
$faq_categ[$arr['lang_id']][$arr['categ']]['items'][$arr['id']]['question'] = $arr['question'];
$faq_categ[$arr['lang_id']][$arr['categ']]['items'][$arr['id']]['flag'] = $arr['flag'];
$faq_categ[$arr['lang_id']][$arr['categ']]['items'][$arr['id']]['order'] = $arr['order'];
}
if (isset($faq_categ))
{
// gather orphaned items
foreach ($faq_categ as $lang => $temp2){
foreach ($temp2 as $id => $temp)
{
if (!array_key_exists("title", $temp2[$id]))
{
foreach ($temp2[$id]['items'] as $id2 => $temp)
{
$faq_orphaned[$lang][$id2]['question'] = $temp2[$id]['items'][$id2]['question'];
$faq_orphaned[$lang][$id2]['flag'] = $temp2[$id]['items'][$id2]['flag'];
unset($temp2[$id]);
}
}
}
}
// print the faq table
print("<form method=\"post\" action=\"faqactions.php?action=reorder\">");
foreach ($faq_categ as $lang => $temp2)
{
foreach ($temp2 as $id => $temp)
{
print("<br />\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\" width=\"95%\">\n");
print("<tr><td class=\"colhead\" align=\"center\" colspan=\"2\">Position</td><td class=\"colhead\" align=\"left\">Section/Item Title</td><td class=\"colhead\" align=\"center\">Language</td><td class=\"colhead\" align=\"center\">Status</td><td class=\"colhead\" align=\"center\">Actions</td></tr>\n");
print("<tr><td align=\"center\" width=\"40px\"><select name=\"order[". $id ."]\">");
for ($n=1; $n <= count($temp2); $n++)
{
$sel = ($n == $temp2[$id]['order']) ? " selected=\"selected\"" : "";
print("<option value=\"$n\"". $sel .">". $n ."</option>");
}
$status = ($temp2[$id]['flag'] == "0") ? "<font color=\"red\">Hidden</font>" : "Normal";
print("</select></td><td align=\"center\" width=\"40px\">&nbsp;</td><td><b>". $temp2[$id]['title'] ."</b></td><td align=\"center\" width=\"60px\">". $temp2[$id]['lang_name'] ."</td><td align=\"center\" width=\"60px\">". $status ."</td><td align=\"center\" width=\"60px\"><a href=\"faqactions.php?action=edit&id=". $temp2[$id]['id'] ."\">Edit</a> <a href=\"faqactions.php?action=delete&id=". $temp2[$id]['id'] ."\">Delete</a></td></tr>\n");
if (array_key_exists("items", $temp2[$id]))
{
foreach ($temp2[$id]['items'] as $id2 => $temp)
{
print("<tr><td align=\"center\" width=\"40px\">&nbsp;</td><td align=\"center\" width=\"40px\"><select name=\"order[". $id2 ."]\">");
for ($n=1; $n <= count($temp2[$id]['items']); $n++)
{
$sel = ($n == $temp2[$id]['items'][$id2]['order']) ? " selected=\"selected\"" : "";
print("<option value=\"$n\"". $sel .">". $n ."</option>");
}
if ($temp2[$id]['items'][$id2]['flag'] == "0") $status = "<font color=\"#FF0000\">Hidden</font>";
elseif ($temp2[$id]['items'][$id2]['flag'] == "2") $status = "<font color=\"#0000FF\"><img src=\"pic/updated.png\" alt=\"Updated\" width=\"46\" height=\"11\" align=\"absbottom\"></font>";
elseif ($temp2[$id]['items'][$id2]['flag'] == "3") $status = "<font color=\"#008000\"><img src=\"pic/new.png\" alt=\"New\" width=\"27\" height=\"11\" align=\"absbottom\"></font>";
else $status = "Normal";
print("</select></td><td>". $temp2[$id]['items'][$id2]['question'] ."</td><td align=\"center\"></td><td align=\"center\" width=\"60px\">". $status ."</td><td align=\"center\" width=\"60px\"><a href=\"faqactions.php?action=edit&id=". $id2 ."\">Edit</a> <a href=\"faqactions.php?action=delete&id=". $id2 ."\">Delete</a></td></tr>\n");
}
}
print("<tr><td colspan=\"6\" align=\"center\"><a href=\"faqactions.php?action=additem&inid=". $id ."&langid=".$lang."\">Add new item</a></td></tr>\n");
print("</table>\n");
}
}
}
// print the orphaned items table
if (isset($faq_orphaned)) {
print("<br />\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\" width=\"95%\">\n");
print("<tr><td align=\"center\" colspan=\"3\"><b style=\"color: #FF0000\">Orphaned Items</b></td>\n");
print("<tr><td class=\"colhead\" align=\"left\">Item Title</td><td class=\"colhead\" align=\"center\">Status</td><td class=\"colhead\" align=\"center\">Actions</td></tr>\n");
foreach ($faq_orphaned as $lang => $temp2){
foreach ($temp2 as $id => $temp)
{
if ($temp2[$id]['flag'] == "0") $status = "<font color=\"#FF0000\">Hidden</font>";
elseif ($temp2[$id]['flag'] == "2") $status = "<font color=\"#0000FF\">Updated</font>";
elseif ($temp2[$id]['flag'] == "3") $status = "<font color=\"#008000\">New</font>";
else $status = "Normal";
print("<tr><td>". $temp2[$id]['question'] ."</td><td align=\"center\" width=\"60px\">". $status ."</td><td align=\"center\" width=\"60px\"><a href=\"faqactions.php?action=edit&id=". $id ."\">edit</a> <a href=\"faqactions.php?action=delete&id=". $id ."\">delete</a></td></tr>\n");
}
}
print("</table>\n");
}
print("<br />\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\" width=\"95%\">\n<tr><td align=\"center\"><a href=\"faqactions.php?action=addsection\">Add new section</a></td></tr>\n</table>\n");
print("<p align=\"center\"><input type=\"submit\" name=\"reorder\" value=\"Reorder\"></p>\n");
print("</form>\n");
print("<p>When the position numbers don't reflect the position in the table, it means the order id is bigger than the total number of sections/items and you should check all the order id's in the table and click \"reorder\"</p>");
echo $pagerbottom ?? '';
end_main_frame();
stdfoot();
?>
+50
View File
@@ -0,0 +1,50 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
require_once(get_langfile_path("",true));
loggedinorreturn();
function bark($msg) {
global $lang_fastdelete;
stdhead();
stdmsg($lang_fastdelete['std_delete_failed'], $msg);
stdfoot();
exit;
}
if (!mkglobal("id"))
bark($lang_fastdelete['std_missing_form_data']);
$id = intval($id ?? 0);
int_check($id);
$sure = $_GET["sure"];
$res = sql_query("SELECT name,owner,seeders,anonymous FROM torrents WHERE id = $id");
$row = mysql_fetch_array($res);
if (!$row)
die();
if (get_user_class() < $torrentmanage_class)
bark($lang_fastdelete['text_no_permission']);
if (!$sure)
{
stderr($lang_fastdelete['std_delete_torrent'], $lang_fastdelete['std_delete_torrent_note']."<a class=altlink href=fastdelete.php?id=$id&sure=1>".$lang_fastdelete['std_here_if_sure'],false);
}
deletetorrent($id);
KPS("-",$uploadtorrent_bonus,$row["owner"]);
if ($row['anonymous'] == 'yes' && $CURUSER["id"] == $row["owner"]) {
write_log("Torrent $id ($row[name]) was deleted by its anonymous uploader",'normal');
} else {
write_log("Torrent $id ($row[name]) was deleted by $CURUSER[username]",'normal');
}
//Send pm to torrent uploader
if ($CURUSER["id"] != $row["owner"]){
$dt = sqlesc(date("Y-m-d H:i:s"));
$subject = sqlesc($lang_fastdelete_target[get_user_lang($row["owner"])]['msg_torrent_deleted']);
$msg = sqlesc($lang_fastdelete_target[get_user_lang($row["owner"])]['msg_the_torrent_you_uploaded'].$row['name'].$lang_fastdelete_target[get_user_lang($row["owner"])]['msg_was_deleted_by']."[url=userdetails.php?id=".$CURUSER['id']."]".$CURUSER['username']."[/url]".$lang_fastdelete_target[get_user_lang($row["owner"])]['msg_blank']);
sql_query("INSERT INTO messages (sender, receiver, subject, added, msg) VALUES(0, $row[owner], $subject, $dt, $msg)") or sqlerr(__FILE__, __LINE__);
}
header("Refresh: 0; url=torrents.php");
?>
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.
+215
View File
@@ -0,0 +1,215 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
stdhead("Downloaded Files");
?>
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
<h2>A Handy Guide to Using the Files You've Downloaded</h2>
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>
Hey guys, here's some info about common files that you can download from the internet,
and a little bit about using these files for their intended purposes. If you're stuck
on what exactly a file is or how to open it maybe your answer lies ahead. If you dont'
find your answer here, then please post in the "Forum". So without further adieu lets
get the show on the road!<br />
</td></tr></table>
</td></tr></table>
<br />
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
<h2>Compression Files</h2>
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>
<b>.rar .zip .ace .r01 .001</b><br />
<br />
These extensions are quite common and mean that your file(s) are compressed into an "archive".<br />
This is just a way of making the files more compact and easier to download.<br />
<br />
To open any of those archives listed above you can use <a href="http://www.rarsoft.com/download.htm">WinRAR</a> (Make sure you have the latest version) or <a href="http://www.powerarchiver.com/download/">PowerArchiver</a>.<br />
<br />
If those progams aren't working for you and you have a .zip file you can try
<a href="http://www.winzip.com/download.htm">WinZip</a> (Trial version).<br />
<br />
If the two first mentioned programs aren't working for you and you have a .ace or .001
file you can try <a href="http://www.winace.com/">Winace</a> (Trial version).<br />
<br />
<br />
<b>.cbr .cbz</b><br />
<br />
These are usually comic books in an archive format. a .cbr file is actually the same
thing as a .rar file and a .cbz file is the same as a .zip file. However, often when
opening them with WinRAR or WinZip it will disorder your pages. To display these
archives properly it's often best to use <a href="http://www.geocities.com/davidayton/CDisplay">
CDisplay</a>.<br />
<br />
</td></tr></table>
</td></tr></table>
<br />
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
<h2>Multimedia Files</h2>
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>
<b>.avi .mpg. .mpeg .divx .xvid .wmv</b><br />
<br />
These files are usually movies or TVshows, or a host of other types of media. They can
be viewed using various media players, but I suggest using
<a href="http://www.inmatrix.com/files/zoomplayer_download.shtml">Zoomplayer</a>,
<a href="http://www.bsplayer.org/">BSPlayer</a>, <a href="http://www.videolan.org/vlc/">VLC media player</a>
or <a href="http://www.microsoft.com/windows/
windowsmedia/default.aspx">Windows Media Player</a>. Also, you'll need to make sure you have
the right codecs to play each individual file. Codecs are a tricky business sometimes so to help
you out with your file and what exact codecs it needs try using <a href="http://www.headbands.com/
gspot/download.html">GSpot</a>. It tells you what codecs you need. Then just look on the net to find
them, below are some common codecs and their download links for quick reference:<br />
<br />
<a href="http://sourceforge.net/project/showfiles.php?group_id=53761&release_id=95213">ffdshow</a> (Recommended! (plays many formats: XviD, DivX, 3ivX, mpeg-4))<br />
<a href="http://nic.dnsalias.com/xvid.html">XviD codec</a><br />
<a href="http://www.divx.com/divx/">DivX codec</a><br />
<a href="http://sourceforge.net/project/showfiles.php?group_id=66022&release_id=178906">ac3filter</a> (for AC3 soundtracks, aka "5.1")<br />
<a href="http://tobias.everwicked.com/oggds.htm">Ogg media codec</a> (for .OGM files)<br />
<br />
Can't find what you're looking for? Check out these sites...<br />
<br />
<a href="http://www.divx-digest.com/">DivX-Digest</a><br />
<a href="http://www.digital-digest.com/">Digital-Digest</a><br />
<a href="http://www.doom9.org/">Doom9</a><br />
<a href="http://www.dvdrhelp.com/">DVD-R Help</a><br />
<br />
<br />
<b>.mov</b><br />
<br />
These are <a href="http://www.apple.com/quicktime/">QuickTime</a> files. Hopefully you
won't have to open these as I hate quicktime, but if you do you can
<a href="http://www.apple.com/quicktime/download/">get it here</a>.
There are however alternatives to the original program,
Check out <a href="http://home.hccnet.nl/h.edskes/finalbuilds.htm">QuickTime Alternative</a>.<br />
<br />
<br />
<b>.ra .rm .ram</b><br />
<br />
These are <a href="http://www.real.com">RealPlayer</a> files. RealPlayer IMO is the
devils work. It installs lord knows what on your system and never really goes away when
you want to uninstall it. Still if you insists you can get the player
<a href="http://service.real.com/downloads.html">here</a>.
There are however alternatives to the original program,
check out <a href="http://home.hccnet.nl/h.edskes/finalbuilds.htm">Real Alternative</a>.<br />
<br />
<br />
<b>vcd/svcd</b><br />
<br />
These can be a pain on some peoples setups, but more so, on your stand-alone DVD player.
For all your vcd needs check out <a href="http://www.dvdrhelp.com">www.dvdrhelp.com</a>.
These guys know their stuff, and can help you with all kinds of media related questions.<br />
<br />
<br />
<b>.mp3 .mp2</b><br />
<br />
Usually music files. Play them with <a href="http://www.winamp.com/">WinAmp</a>.<br />
<br />
<br />
<b>.ogm .ogg</b><br />
<br />
Ogg Vorbis media files. You can find out more about them and download applications
<a href="http://www.vorbis.com/download.psp">here</a>.
This filetype is another music file format, but can be used for various media. You will
probably want to download the <a href="http://tobias.everwicked.com/oggds.htm">
DirectShow Ogg filter</a> to play back OGM files. Any new version of
<a href="http://www.winamp.com">WinAmp</a> will also do.<br />
<br />
</td></tr></table>
</td></tr></table>
<br />
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
<h2>CD Image Files</h2>
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>
<b>.bin and .cue</b><br />
<br />
These are your standard images of a CD, and are used quite alot these days. To open them
you have a couple options. You can burn them using <a href="http://www.ahead.de">Nero</a>
(Trial Version) or <a href="http://www.alcohol-software.com/">Alcohol 120%</a>,
but this proves to be soooooooo problematic for a lot of people. You should also consult
this tutorial for burning images with various software programs You can also use
<a href="http://www.daemon-tools.cc/portal/portal.php">Daemon Tools</a>, which lets you
mount the image to a "virtual cd-rom", so basically it tricks your computer into thinking
that you have another cd-rom and that you're putting a cd with your image file on it into
this virtual cd-rom, it's great cuz you'll never make a bad cd again, Alcohol 120% also
sports a virtual cd-rom feature. Finally, if you're still struggling to access the files
contained within any given image file you can use <a href="http://cdmage.cjb.net/">CDMage</a>
to extract the files and then burn them, or just access them from your hard drive. You can
also use <a href="http://www.vcdgear.com/">VCDGear</a> to extract the mpeg contents of a
SVCD or VCD image file such as bin/cue.<br />
<br />
<br />
<b>.iso</b><br />
<br />
Another type of image file that follows similar rules as .bin and .cue, only you extract
or create them using <a href="http://www.winiso.com">WinISO</a> or
<a href="http://ww.smart-projects.net/isobuster/">ISOBuster.</a> Sometimes converting a
problematic .bin and .cue file to an .iso can help you burn it to a cd.<br />
<br />
<br />
<b>.ccd .img .sub</b><br />
<br />
All these files go together and are in the <a href="http://www.elby.ch/english/products/
clone_cd/index.html"> CloneCD</a> format. CloneCD is like most other CD-Burning programs,
see the .bin and .cue section if you're having problems with these files.<br />
<br />
</td></tr></table>
</td></tr></table>
<br />
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
<h2>Other Files</h2>
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>
<b>.txt .doc</b><br />
<br />
These are text files. .txt files can be opened with notepad or watever you default text
editor happens to be, and .doc are opened with Microsoft Word.<br />
<br />
<br />
<b>.nfo</b><br />
<br />
These contain information about the file you just downloaded, and it's HIGHLY recommended
that you read these! They are plain text files, often with ascii-art. You can open them
with Notepad, Wordpad, <a href="http://www.damn.to/software/nfoviewer.html">DAMN NFO Viewer</a>
or <a href="http://www.ultraedit.com/">UltraEdit</a>.<br />
<br />
<br />
<b>.pdf</b><br />
<br />
Opened with <a href="http://www.adobe.com/products/acrobat/main.html">Adobe Acrobat Reader</a>.<br />
<br />
<br />
<b>.jpg .gif .tga .psd</b><br />
<br />
Basic image files. These files generally contain pictures, and can be opened with Adobe
Photoshop or whatever your default image viewer is.<br />
<br />
<br />
<b>.sfv</b><br />
<br />
Checks to make sure that your multi-volume archives are complete. This just lets you know
if you've downloaded something complete or not. (This is not really an issue when DL:ing
via torrent.) You can open/activate these files with <a href="http://www.traction-software.co.uk/SFVChecker/">
SFVChecker</a> (Trial version) or <a href="http://www.big-o-software.com/products/hksfv/">hkSFV</a> for example.<br />
<br />
<br />
<p><b>.par</b></p>
This is a parity file, and is often used when downloading from newsgroups. These files can
fill in gaps when you're downloading a multi-volume archive and get corrupted or missing parts.
Open them with <a href="http://www.pbclements.co.uk/QuickPar/">QuickPar</a>.
<br />
</td></tr></table>
</td></tr></table>
<br />
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>
If you have any suggestion/changes <a href=staff.php><b>PM</b></a> one of the Admins/SysOp!<br />
<br />
This file was originally written by hussdiesel at filesoup, then edited by Rhomboid and re-edited by us.<br />
</td></tr></table>
</td></tr></table>
<br />
<?php
+303
View File
@@ -0,0 +1,303 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
//lots of place use this variable
$prefix = '';
$user = $CURUSER;
$PHP_SELF = $_SERVER['PHP_SELF'];
if (get_user_class() < $forummanage_class)
permissiondenied();
// DELETE FORUM ACTION
if (isset($_GET['action']) && $_GET['action'] == "del") {
$id = intval($_GET['id'] ?? 0);
if (!$id) {
header("Location: forummanage.php");
die();
}
$result = sql_query ("SELECT * FROM topics where forumid = ".sqlesc($id));
if ($row = mysql_fetch_array($result)) {
do {
sql_query ("DELETE FROM posts where topicid = ".$row["id"]) or sqlerr(__FILE__, __LINE__);
} while($row = mysql_fetch_array($result));
}
sql_query ("DELETE FROM topics where forumid = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
sql_query ("DELETE FROM forums where id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
sql_query ("DELETE FROM forummods where forumid = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('forums_list');
$Cache->delete_value('forum_moderator_array');
header("Location: forummanage.php");
die();
}
//EDIT FORUM ACTION
elseif (isset($_POST['action']) && $_POST['action'] == "editforum") {
$name = $_POST['name'];
$desc = $_POST['desc'];
$id = $_POST['id'];
if (!$name && !$desc && !$id) {
header("Location: " . get_protocol_prefix() . "$BASEURL/forummanage.php");
die();
}
if (!empty($_POST["moderator"])) {
$moderator = $_POST["moderator"];
set_forum_moderators($moderator,$id);
}
else{
sql_query("DELETE FROM forummods WHERE forumid=".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
}
sql_query("UPDATE forums SET sort = '" . $_POST['sort'] . "', name = " . sqlesc($_POST['name']). ", description = " . sqlesc($_POST['desc']). ", forid = ".sqlesc(($_POST['overforums'])).", minclassread = '" . $_POST['readclass'] . "', minclasswrite = '" . $_POST['writeclass'] . "', minclasscreate = '" . $_POST['createclass'] . "' where id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('forums_list');
$Cache->delete_value('forum_moderator_array');
header("Location: forummanage.php");
die();
}
//ADD FORUM ACTION
elseif (isset($_POST['action']) && $_POST['action'] == "addforum") {
$name = ($_POST['name']);
$desc = ($_POST['desc']);
if (!$name && !$desc) {
header("Location: " . get_protocol_prefix() . "$BASEURL/forummanage.php");
die();
}
sql_query("INSERT INTO forums (sort, name, description, minclassread, minclasswrite, minclasscreate, forid) VALUES(" . $_POST['sort'] . ", " . sqlesc($_POST['name']). ", " . sqlesc($_POST['desc']). ", " . $_POST['readclass'] . ", " . $_POST['writeclass'] . ", " . $_POST['createclass'] . ", ".sqlesc(($_POST['overforums'])).")") or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('forums_list');
if ($_POST["moderator"]){
$id = mysql_insert_id();
$moderator = $_POST["moderator"];
set_forum_moderators($moderator,$id);
}
header("Location: forummanage.php");
die();
}
// SHOW FORUMS WITH FORUM MANAGMENT TOOLS
stdhead($lang_forummanage['head_forum_management']);
begin_main_frame();
if (isset($_GET['action']) && $_GET['action'] == "editforum") {
//EDIT PAGE FOR THE FORUMS
$id = intval($_GET["id"] ?? 0);
$result = sql_query ("SELECT * FROM forums where id = ".sqlesc($id));
if ($row = mysql_fetch_array($result)) {
do {
?>
<h1 align=center><a class=faqlink href=forummanage.php><?php echo $lang_forummanage['text_forum_management']?></a><b>--></b><?php echo $lang_forummanage['text_edit_forum']?></h2>
<br />
<form method=post action="<?php echo $_SERVER["PHP_SELF"];?>">
<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center">
<tr align="center">
<td colspan="2" class=colhead><?php echo $lang_forummanage['text_edit_forum']?> -- <?php echo htmlspecialchars($row["name"]);?></td>
</tr>
<td><b><?php echo $lang_forummanage['row_forum_name']?></td>
<td><input name="name" type="text" style="width: 200px" maxlength="60" value="<?php echo $row["name"];?>"></td>
</tr>
<tr>
<td><b><?php echo $lang_forummanage['row_forum_description']?></td>
<td><input name="desc" type="text" style="width: 400px" maxlength="200" value="<?php echo $row["description"];?>"></td>
</tr>
<tr>
<td><b><?php echo $lang_forummanage['row_overforum']?></td>
<td>
<select name=overforums>
<?php
$forid = $row["forid"];
$res = sql_query("SELECT * FROM overforums");
while ($arr = mysql_fetch_array($res)) {
$name = $arr["name"];
$i = $arr["id"];
print("<option value=$i" . ($forid == $i ? " selected" : "") . ">$prefix" . $name . "\n");
}
?>
</select>
</td>
</tr>
<?php
$username = get_forum_moderators($row['id'],true);
?>
<tr><td><b><?php echo $lang_forummanage['row_moderator']?></b></td><td><input name="moderator" type="text" style="width: 200px" maxlength="200" value="<?php echo $username?>">&nbsp;<?php echo $lang_forummanage['text_moderator_note']?></td></tr>
<tr>
<td><b><?php echo $lang_forummanage['row_minimum_read_permission']?></td>
<td>
<select name=readclass>
<?php
$maxclass = get_user_class();
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i" . ($row["minclassread"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true));
?>
</select>
</td>
</tr>
<tr>
<td><b><?php echo $lang_forummanage['row_minimum_write_permission']?></td>
<td><select name=writeclass>
<?php
$maxclass = get_user_class();
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i" . ($row["minclasswrite"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
?>
</select></td>
</tr>
<tr>
<td><b><?php echo $lang_forummanage['row_minimum_create_topic_permission']?></td>
<td><select name=createclass>
<?php
$maxclass = get_user_class();
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i" . ($row["minclasscreate"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
?>
</select></td>
</tr>
<tr>
<td><b><?php echo $lang_forummanage['row_forum_order']?></td>
<td>
<select name=sort>
<?php
$res = sql_query ("SELECT sort FROM forums");
$nr = mysql_num_rows($res);
$maxclass = $nr + 1;
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i" . ($row["sort"] == $i ? " selected" : "") . ">$i \n");
?>
</select>
<?php echo $lang_forummanage['text_forum_order_note']?></td>
</tr>
<tr align="center">
<td colspan="2"><input type="hidden" name="action" value="editforum"><input type="hidden" name="id" value="<?php echo $id;?>"><input type="submit" name="Submit" value="<?php echo $lang_forummanage['submit_edit_forum']?>" class="btn"></td>
</tr>
</table>
<?php
} while($row = mysql_fetch_array($result));
}
else
{
print ($lang_forummanage['text_no_records_found']);
}
}
//
elseif (isset($_GET['action']) && $_GET['action'] == "newforum"){
?>
<h2 class=transparentbg align=center><a class=faqlink href=forummanage.php><?php echo $lang_forummanage['text_forum_management']?></a><b>--></b><?php echo $lang_forummanage['text_add_forum']?></h2>
<br />
<form method=post action="<?php echo $_SERVER["PHP_SELF"];?>">
<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center">
<tr align="center">
<td colspan="2" class=colhead><?php echo $lang_forummanage['text_make_new_forum']?></td>
</tr>
<tr>
<td><b><?php echo $lang_forummanage['row_forum_name']?></td>
<td><input name="name" type="text" style="width: 200px" maxlength="60"></td>
</tr>
<tr>
<td><b><?php echo $lang_forummanage['row_forum_description']?></td>
<td><input name="desc" type="text" style="width: 400px" maxlength="200"></td>
</tr>
<tr>
<td><b><?php echo $lang_forummanage['row_overforum']?></td>
<td>
<select name=overforums>
<?php
$forid = $row["forid"];
$res = sql_query("SELECT * FROM overforums");
while ($arr = mysql_fetch_array($res)) {
$name = $arr["name"];
$i = $arr["id"];
print("<option value=$i" . ($forid == $i ? " selected" : "") . ">$prefix" . $name . "\n");
}
?>
</select>
</td>
</tr>
<tr><td><b><?php echo $lang_forummanage['row_moderator']?></b></td><td><input name="moderator" type="text" style="width: 200px" maxlength="200">&nbsp;<?php echo $lang_forummanage['text_moderator_note']?></td></tr>
<tr>
<td><b><?php echo $lang_forummanage['row_minimum_read_permission']?></td>
<td>
<select name=readclass>
<?php
$maxclass = get_user_class();
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i" . ($user["class"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
?>
</select>
</td>
</tr>
<tr>
<td><b><?php echo $lang_forummanage['row_minimum_write_permission']?></td>
<td><select name=writeclass>
<?php
$maxclass = get_user_class();
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i" . ($user["class"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
?>
</select></td>
</tr>
<tr>
<td><b><?php echo $lang_forummanage['row_minimum_create_topic_permission']?></td>
<td><select name=createclass>
<?php
$maxclass = get_user_class();
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i" . ($user["class"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
?>
</select></td>
</tr>
<tr>
<td><b><?php echo $lang_forummanage['row_forum_order']?></td>
<td>
<select name=sort>
<?php
$res = sql_query ("SELECT sort FROM forums");
$nr = mysql_num_rows($res);
$maxclass = $nr + 1;
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i>$i \n");
?>
</select>
<?php echo $lang_forummanage['text_forum_order_note']?></td>
</tr>
<tr align="center">
<td colspan="2"><input type="hidden" name="action" value="addforum"><input type="submit" name="Submit" value="<?php echo $lang_forummanage['submit_make_forum']?>" class=btn></td>
</tr>
</table>
<?php
}
else {
?>
<h2 class=transparentbg align=center><?php echo $lang_forummanage['text_forum_management']?></h2>
<table border=0 class=main cellspacing=0 cellpadding=5 width=1%><tr>
<td class=embedded align=left><form method="get" action="moforums.php"><input type="submit" value="<?php echo $lang_forummanage['submit_overforum_management']?>" class="btn"></form></td><td class=embedded align=left><form method="get" action="forummanage.php"><input type=hidden name="action" value="newforum"><input type="submit" value="<?php echo $lang_forummanage['submit_add_forum']?>" class="btn"></form></td>
</tr></table>
<?php
echo '<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">';
echo "<tr><td class=colhead align=left>".$lang_forummanage['col_name']."</td><td class=colhead>".$lang_forummanage['col_overforum']."</td><td class=colhead>".$lang_forummanage['col_read']."</td><td class=colhead>".$lang_forummanage['col_write']."</td><td class=colhead>".$lang_forummanage['col_create_topic']."</td><td class=colhead>".$lang_forummanage['col_moderator']."</td><td class=colhead>".$lang_forummanage['col_modify']."</td></tr>";
$result = sql_query ("SELECT forums.*, overforums.name AS of_name FROM forums LEFT JOIN overforums ON forums.forid=overforums.id ORDER BY forums.sort ASC");
if ($row = mysql_fetch_array($result)) {
do {
$name = $row['of_name'];
$moderators = get_forum_moderators($row['id'],false);
if (!$moderators)
$moderators = $lang_forummanage['text_not_available'];
echo "<tr><td><a href=forums.php?action=viewforum&forumid=".$row["id"]."><b>".htmlspecialchars($row["name"])."</b></a><br />".htmlspecialchars($row["description"])."</td>";
echo "<td>".htmlspecialchars($name)."</td><td>" . get_user_class_name($row["minclassread"],false,true,true) . "</td><td>" . get_user_class_name($row["minclasswrite"],false,true,true) . "</td><td>" . get_user_class_name($row["minclasscreate"],false,true,true) . "</td><td>".$moderators."</td><td><b><a href=\"".$PHP_SELF."?action=editforum&id=".$row["id"]."\">".$lang_forummanage['text_edit']."</a>&nbsp;|&nbsp;<a href=\"javascript:confirm_delete('".$row["id"]."', '".$lang_forummanage['js_sure_to_delete_forum']."', '');\"><font color=red>".$lang_forummanage['text_delete']."</font></a></b></td></tr>";
} while($row = mysql_fetch_array($result));
} else {print "<tr><td colspan=6>".$lang_forummanage['text_no_records_found']."</td></tr>";}
echo "</table>";
}
end_main_frame();
stdfoot();
+1537
View File
File diff suppressed because it is too large Load Diff
+49
View File
@@ -0,0 +1,49 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_ADMINISTRATOR)
stderr("Error", "Permission denied.");
$action = isset($_POST['action']) ? htmlspecialchars($_POST['action']) : (isset($_GET['action']) ? htmlspecialchars($_GET['action']) : 'main');
if ($action == 'setallfree')
{
sql_query("UPDATE torrents_state SET global_sp_state = 2");
$Cache->delete_value('global_promotion_state');
stderr('Success','All torrents have been set free..');
}
elseif ($action == 'setall2up')
{
sql_query("UPDATE torrents_state SET global_sp_state = 3");
$Cache->delete_value('global_promotion_state');
stderr('Success','All torrents have been set 2x up..');
}
elseif ($action == 'setall2up_free')
{
sql_query("UPDATE torrents_state SET global_sp_state = 4");
$Cache->delete_value('global_promotion_state');
stderr('Success','All torrents have been set 2x up and free..');
}
elseif ($action == 'setallhalf_down')
{
sql_query("UPDATE torrents_state SET global_sp_state = 5");
$Cache->delete_value('global_promotion_state');
stderr('Success','All torrents have been set half down..');
}
elseif ($action == 'setall2up_half_down')
{
sql_query("UPDATE torrents_state SET global_sp_state = 6");
$Cache->delete_value('global_promotion_state');
stderr('Success','All torrents have been set half down..');
}
elseif ($action == 'setallnormal')
{
sql_query("UPDATE torrents_state SET global_sp_state = 1");
$Cache->delete_value('global_promotion_state');
stderr('Success','All torrents have been set normal..');
}
elseif ($action == 'main')
{
stderr('Select action','Click <a class=altlink href=freeleech.php?action=setallfree>here</a> to set all torrents free.. <br /> Click <a class=altlink href=freeleech.php?action=setall2up>here</a> to set all torrents 2x up..<br /> Click <a class=altlink href=freeleech.php?action=setall2up_free>here</a> to set all torrents 2x up and free.. <br />Click <a class=altlink href=freeleech.php?action=setallhalf_down>here</a> to set all torrents half down..<br />Click <a class=altlink href=freeleech.php?action=setall2up_half_down>here</a> to set all torrents 2x up and half down..<br />Click <a class=altlink href=freeleech.php?action=setallnormal>here</a> to set all torrents normal..', false);
}
?>
+356
View File
@@ -0,0 +1,356 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
parked();
function purge_neighbors_cache()
{
global $CURUSER;
$cachefile = "cache/" . get_langfolder_cookie() . "/neighbors/" . $CURUSER['id'] . ".html";
if (file_exists($cachefile))
unlink($cachefile);
}
//make_folder("cache/" , get_langfolder_cookie());
//make_folder("cache/" , get_langfolder_cookie() . "/neighbors");
$userid = $CURUSER['id'];
$action = $_GET['action'] ?? '';
if (!is_valid_id($userid))
stderr($lang_friends['std_error'], $lang_friends['std_invalid_id']."$userid.");
$user = $CURUSER;
// action: add -------------------------------------------------------------
if ($action == 'add')
{
$targetid = $_GET['targetid'];
$type = $_GET['type'];
if (!is_valid_id($targetid))
stderr($lang_friends['std_error'], $lang_friends['std_invalid_id']."$targetid.");
if ($type == 'friend')
{
$table_is = $frag = 'friends';
$field_is = 'friendid';
}
elseif ($type == 'block')
{
$table_is = $frag = 'blocks';
$field_is = 'blockid';
}
else
stderr($lang_friends['std_error'], $lang_friends['std_unknown_type']."$type");
$r = sql_query("SELECT id FROM $table_is WHERE userid=$userid AND $field_is=$targetid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($r) == 1)
stderr($lang_friends['std_error'], $lang_friends['std_user_id'].$targetid.$lang_friends['std_already_in'].$table_is.$lang_friends['std_list']);
sql_query("INSERT INTO $table_is VALUES (0,$userid, $targetid)") or sqlerr(__FILE__, __LINE__);
purge_neighbors_cache();
header("Location: " . get_protocol_prefix() . "$BASEURL/friends.php?id=$userid#$frag");
die;
}
// action: delete ----------------------------------------------------------
if ($action == 'delete')
{
$targetid = $_GET['targetid'];
$sure = $_GET['sure'];
$type = $_GET['type'];
if ($type == 'friend')
$typename = $lang_friends['text_friend'];
else $typename = $lang_friends['text_block'];
if (!is_valid_id($targetid))
stderr($lang_friends['std_error'], $lang_friends['std_invalid_id']."$userid.");
if (!$sure)
stderr($lang_friends['std_delete'].$type, $lang_friends['std_delete_note'].$typename.$lang_friends['std_click'].
"<a href=?id=$userid&action=delete&type=$type&targetid=$targetid&sure=1>".$lang_friends['std_here_if_sure'],false);
if ($type == 'friend')
{
sql_query("DELETE FROM friends WHERE userid=$userid AND friendid=$targetid") or sqlerr(__FILE__, __LINE__);
if (mysql_affected_rows() == 0)
stderr($lang_friends['std_error'], $lang_friends['std_no_friend_found']."$targetid");
$frag = "friends";
}
elseif ($type == 'block')
{
sql_query("DELETE FROM blocks WHERE userid=$userid AND blockid=$targetid") or sqlerr(__FILE__, __LINE__);
if (mysql_affected_rows() == 0)
stderr($lang_friends['std_error'], $lang_friends['std_no_block_found']."$targetid");
$frag = "blocks";
}
else
stderr($lang_friends['std_error'], $lang_friends['std_unknown_type']."$type");
purge_neighbors_cache();
header("Location: " . get_protocol_prefix() . "$BASEURL/friends.php?id=$userid#$frag");
die;
}
// main body -----------------------------------------------------------------
stdhead($lang_friends['head_personal_lists_for']. $user['username']);
print("<p><table class=main border=0 cellspacing=0 cellpadding=0>".
"<tr><td class=embedded><h1 style='margin:0px'> " . $lang_friends['text_personallist'] . " ".get_username($user['id'])."</h1></td></tr></table></p>\n");
//Start: Friends
print("<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>");
print("<br />");
print("<h2 align=left><a name=\"friends\">" . $lang_friends['text_friendlist'] . "</a></h2>\n");
print("<table width=737 border=1 cellspacing=0 cellpadding=5><tr class=tablea><td>");
$i = 0;
unset($friend_id_arr);
$res = sql_query("SELECT f.friendid as id, u.last_access, u.class, u.avatar, u.title FROM friends AS f LEFT JOIN users as u ON f.friendid = u.id WHERE userid=$userid ORDER BY id") or sqlerr(__FILE__, __LINE__);
if(mysql_num_rows($res) == 0)
$friends = $lang_friends['text_friends_empty'];
else
while ($friend = mysql_fetch_array($res))
{
$friend_id_arr[] = $friend["id"];
$title = $friend["title"];
if (!$title)
$title = get_user_class_name($friend["class"],false,true,true);
$body1 = get_username($friend["id"]) .
" ($title)<br /><br />".$lang_friends['text_last_seen_on']. gettime($friend['last_access'],true, false);
$body2 = "<a href=friends.php?id=$userid&action=delete&type=friend&targetid=" . $friend['id'] . ">".$lang_friends['text_remove_from_friends']."</a>".
"<br /><br /><a href=sendmessage.php?receiver=" . $friend['id'] . ">".$lang_friends['text_send_pm']."</a>";
$avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($friend["avatar"]) : "");
if (!$avatar)
$avatar = "pic/default_avatar.png";
if ($i % 2 == 0)
print("<table width=100% style='padding: 0px'><tr><td class=bottom style='padding: 5px' width=50% align=center>");
else
print("<td class=bottom style='padding: 5px' width=50% align=center class=tablea>");
print("<table class=main width=100% height=75px class=tablea>");
print("<tr valign=top class=tableb><td width=75 align=center style='padding: 0px'>" .
($avatar ? "<div style='width:75px;height:75px;overflow: hidden'><img width=75px src=\"$avatar\"></div>" : ""). "</td><td>\n");
print("<table class=main>");
print("<tr><td class=embedded style='padding: 5px' width=80%>$body1</td>\n");
print("<td class=embedded style='padding: 5px' width=20%>$body2</td></tr>\n");
print("</table>");
print("</td></tr>");
print("</td></tr></table>\n");
if ($i % 2 == 1)
print("</td></tr></table>\n");
else
print("</td>\n");
$i++;
}
if ($i % 2 == 1)
print("<td class=bottom width=50%>&nbsp;</td></tr></table>\n");
print($friends);
print("</td></tr></table><br />\n");
//End: Friends
//Start: Neighbors
/*
print("<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>");
print("<br />");
print("<h2 align=left><a name=\"friendsadded\">".$lang_friends['text_neighbors']."</a></h2>\n");
print("<table width=737 border=1 cellspacing=0 cellpadding=5><tr class=tablea><td>");
$i = 0;
$cachefile = "cache/" . get_langfolder_cookie() . "/neighbors/" . $CURUSER['id'] . ".html";
$cachetime = 24 * 60 * 60; // 1 day
if (file_exists($cachefile) && (time() - $cachetime< filemtime($cachefile)))
{
include($cachefile);
}
else
{
ob_start(); // start the output buffer
$user_snatched = sql_query("SELECT * FROM snatched WHERE userid = $CURUSER[id]") or sqlerr(__FILE__, __LINE__);
if(mysql_num_rows($user_snatched) == 0)
$neighbors_info = $lang_friends['text_neighbors_empty'];
else
{
while ($user_snatched_arr = mysql_fetch_array($user_snatched))
{
$torrent_2_user_value = get_torrent_2_user_value($user_snatched_arr);
$user_snatched_res_target = sql_query("SELECT * FROM snatched WHERE torrentid = " . $user_snatched_arr['torrentid'] . " AND userid != " . $user_snatched_arr['userid']) or sqlerr(__FILE__, __LINE__); //
if(mysql_num_rows($user_snatched_res_target)>0) // have other peole snatched this torrent
{
while($user_snatched_arr_target = mysql_fetch_array($user_snatched_res_target)) // find target user's current analyzing torrent's snatch info
{
$torrent_2_user_value_target = get_torrent_2_user_value($user_snatched_arr_target); //get this torrent to target user's value
if(!isset($other_user_2_curuser_value[$user_snatched_arr_target['userid']])) // first, set to 0
$other_user_2_curuser_value[$user_snatched_arr_target['userid']] = 0.0;
$other_user_2_curuser_value[$user_snatched_arr_target['userid']] += $torrent_2_user_value_target * $torrent_2_user_value;
}
}
}
arsort($other_user_2_curuser_value,SORT_NUMERIC);
$counter = 0;
$total_user = count($other_user_2_curuser_value);
while(1)
{
list($other_user_2_curuser_value_key, $other_user_2_curuser_value_val) = each($other_user_2_curuser_value);
//print(" userid: " . $other_user_2_curuser_value_key . " value: " . $other_user_2_curuser_value_val . "<br />");
$neighbors_res = sql_query("SELECT * FROM users WHERE id = " . intval($other_user_2_curuser_value_key)) or sqlerr(__FILE__, __LINE__);
if(mysql_num_rows($neighbors_res) == 1)
{
$neighbors_arr = mysql_fetch_array($neighbors_res) or sqlerr(__FILE__, __LINE__);
if($neighbors_arr['enabled'] == 'yes')
{
$title = $neighbors_arr["title"];
if (!$title)
$title = get_user_class_name($neighbors_arr["class"],false,true,true);
$body1 = get_username($neighbors_arr["id"]) .
" ($title)<br /><br />".$lang_friends['text_last_seen_on']. gettime($neighbors_arr['last_access'], true, false);
$body2 = ((empty($friend_id_arr)||(!in_array($neighbors_arr["id"],$friend_id_arr))) ? "<a href=friends.php?id=$userid&action=add&type=friend&targetid=" . $neighbors_arr['id'] . ">".$lang_friends['text_add_to_friends']."</a>" : "<a href=friends.php?id=$userid&action=delete&type=friend&targetid=" . $neighbors_arr['id'] . ">".$lang_friends['text_remove_from_friends']."</a>") .
"<br /><br /><a href=sendmessage.php?receiver=" . $neighbors_arr['id'] . ">".$lang_friends['text_send_pm']."</a>";
$avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($neighbors_arr["avatar"]) : "");
if (!$avatar)
$avatar = "pic/default_avatar.png";
if ($i % 2 == 0)
print("<table width=100% style='padding: 0px'><tr><td class=bottom style='padding: 5px' width=50% align=center>");
else
print("<td class=bottom style='padding: 5px' width=50% align=center>");
print("<table class=main width=100% height=75px>");
print("<tr valign=top><td width=75 align=center style='padding: 0px'>" .
($avatar ? "<div style='width:75px;height:75px;overflow: hidden'><img width=75px src=\"$avatar\"></div>" : ""). "</td><td>\n");
print("<table class=main>");
print("<tr><td class=embedded style='padding: 5px' width=80%>$body1</td>\n");
print("<td class=embedded style='padding: 5px' width=20%>$body2</td></tr>\n");
print("</table>");
print("</td></tr>");
print("</td></tr></table>\n");
if ($i % 2 == 1)
print("</td></tr></table>\n");
else
print("</td>\n");
$i++;
$counter++;
}
}
$total_user--;
if($counter == 20 || $total_user<=0) break; //only the largest 20
}
}
if ($i % 2 == 1)
print("<td class=bottom width=50%>&nbsp;</td></tr></table>\n");
print($neighbors_info);
print("</td></tr></table></table><br />\n");
// CACHE END //////////////////////////////////////////////////
// open the cache file for writing
$fp = fopen($cachefile, 'w');
// save the contents of output buffer to the file
fwrite($fp, ob_get_contents());
// close the file
fclose($fp);
// Send the output to the browser
ob_end_flush();
/////////////////////////////////////////////////////////
}
if(mysql_num_rows($friendadd) == 0)
$friendsno = $lang_friends['text_friends_empty'];
else
while ($friend = mysql_fetch_array($friendadd))
{
$title = $friend["title"];
if (!$title)
$title = get_user_class_name($friend["class"],false,true,true);
$body1 = get_username($friend["fuid"]) .
" ($title)<br /><br />".$lang_friends['text_last_seen_on']. $friend['last_access'] .
"<br />(" . get_elapsed_time(strtotime($friend[last_access])) . $lang_friends['text_ago'].")";
$body2 = "<a href=friends.php?id=$userid&action=add&type=friend&targetid=" . $friend['fuid'] . ">".$lang_friends['text_add_to_friends']."</a>".
"<br /><br /><a href=sendmessage.php?receiver=" . $friend['fuid'] . ">".$lang_friends['text_send_pm']."</a>";
$avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($friend["avatar"]) : "");
if (!$avatar)
$avatar = "pic/default_avatar.png";
if ($i % 2 == 0)
print("<table width=100% style='padding: 0px'><tr><td class=bottom style='padding: 5px' width=50% align=center>");
else
print("<td class=bottom style='padding: 5px' width=50% align=center class=tablea>");
print("<table class=main width=100% height=75px class=tablea>");
print("<tr valign=top class=tableb><td width=75 align=center style='padding: 0px'>" .
($avatar ? "<div style='width:75px;height:75px;overflow: hidden'><img width=75px src=\"$avatar\"></div>" : ""). "</td><td>\n");
print("<table class=main>");
print("<tr><td class=embedded style='padding: 5px' width=80%>$body1</td>\n");
print("<td class=embedded style='padding: 5px' width=20%>$body2</td></tr>\n");
print("</table>");
print("</td></tr>");
print("</td></tr></table>\n");
if ($i % 2 == 1)
print("</td></tr></table>\n");
else
print("</td>\n");
$i++;
}
if ($i % 2 == 1)
print("<td class=bottom width=50%>&nbsp;</td></tr></table>\n");
print($neighbors_info);
print("</td></tr></table></table><br />\n");
*/
//End: Neighbors
$res = sql_query("SELECT blockid as id FROM blocks WHERE userid=$userid ORDER BY id") or sqlerr(__FILE__, __LINE__);
if(mysql_num_rows($res) == 0)
$blocks = $lang_friends['text_blocklist_empty'];
else
{
$i = 0;
$blocks = "<table width=100% cellspacing=0 cellpadding=0>";
while ($block = mysql_fetch_array($res))
{
if ($i % 6 == 0)
$blocks .= "<tr>";
$blocks .= "<td style='border: none; padding: 4px; spacing: 0px;'>[<font class=small><a href=friends.php?id=$userid&action=delete&type=block&targetid=" .
$block['id'] . ">D</a></font>] " . get_username($block["id"]) . "</td>";
if ($i % 6 == 5)
$blocks .= "</tr>";
$i++;
}
$blocks .= "</table>\n";
}
print("<br /><br />");
print("<table class=main width=737 border=0 cellspacing=0 cellpadding=5><tr><td class=embedded>");
print("<h2 align=left><a name=\"blocks\">".$lang_friends['text_blocked_users']."</a></h2></td></tr>");
print("<tr class=tableb><td style='padding: 10px;'>");
print($blocks);
print("</td></tr></table>\n");
print("</td></tr></table>\n");
if (get_user_class() >= $viewuserlist_class)
print("<p><a href=users.php><b>".$lang_friends['text_find_user']."</b></a></p>");
stdfoot();
?>
+285
View File
@@ -0,0 +1,285 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
require_once(get_langfile_path("",true));
$action=$_GET["action"];
if (!$action)
{
$action = (string) $_POST['action'];
if (!$action)
$action = 'view';
}
if ($action == 'delete')
{
$id = intval($_GET["id"] ?? 0);
int_check($id,true);
$res = sql_query("SELECT userid FROM fun WHERE id=$id") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_array($res);
if (!$arr)
stderr($lang_fun['std_error'], $lang_fun['std_invalid_id']);
if (get_user_class() < $funmanage_class)
permissiondenied();
$sure = intval($_GET["sure"] ?? 0);
$returnto = $_GET["returnto"] ? htmlspecialchars($_GET["returnto"]) : htmlspecialchars($_SERVER["HTTP_REFERER"]);
if (!$sure)
stderr($lang_fun['std_delete_fun'],$lang_fun['text_please_click'] ."<a class=altlink href=?action=delete&id=$id&returnto=$returnto&sure=1>".$lang_fun['text_here_if_sure'],false);
sql_query("DELETE FROM fun WHERE id=".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('current_fun_content');
$Cache->delete_value('current_fun', true);
$Cache->delete_value('current_fun_vote_count');
$Cache->delete_value('current_fun_vote_funny_count');
if ($returnto != "")
header("Location: $returnto");
}
if ($action == 'new')
{
$sql = "SELECT *, IF(ADDTIME(added, '1 0:0:0') < NOW(),true,false) AS neednew FROM fun WHERE status != 'banned' AND status != 'dull' ORDER BY added DESC LIMIT 1";
$result = sql_query($sql) or sqlerr(__FILE__,__LINE__);
$row = mysql_fetch_array($result);
if ($row && !$row['neednew'])
stderr($lang_fun['std_error'],$lang_fun['std_the_newest_fun_item'].htmlspecialchars($row['title']).$lang_fun['std_posted_on'].$row['added'].$lang_fun['std_need_to_wait']);
else {
stdhead($lang_fun['head_new_fun']);
begin_main_frame();
$title = $lang_fun['text_submit_new_fun'];
print("<form id=compose method=post name=\"compose\" action=?action=add>\n");
begin_compose($title, 'new');
end_compose();
end_main_frame();
}
stdfoot();
}
if ($action == 'add')
{
$sql = "SELECT *, IF(ADDTIME(added, '1 0:0:0') < NOW(),true,false) AS neednew FROM fun WHERE status != 'banned' AND status != 'dull' ORDER BY added DESC LIMIT 1";
$result = sql_query($sql) or sqlerr(__FILE__,__LINE__);
$row = mysql_fetch_array($result);
if ($row && !$row['neednew'])
stderr($lang_fun['std_error'],$lang_fun['std_the_newest_fun_item'].htmlspecialchars($row['title']).$lang_fun['std_posted_on'].$row['added'].$lang_fun['std_need_to_wait']);
else {
$body = $_POST['body'];
if (!$body)
stderr($lang_fun['std_error'],$lang_fun['std_body_is_empty']);
$title = htmlspecialchars($_POST['subject']);
if (!$title)
stderr($lang_fun['std_error'],$lang_fun['std_title_is_empty']);
$sql = "INSERT INTO fun (userid, added, body, title, status) VALUES (".sqlesc($CURUSER['id']).",".sqlesc(date("Y-m-d H:i:s")).",".sqlesc($body).",".sqlesc($title).", 'normal')";
sql_query($sql) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('current_fun_content');
$Cache->delete_value('current_fun', true);
$Cache->delete_value('current_fun_vote_count');
$Cache->delete_value('current_fun_vote_funny_count');
if (mysql_affected_rows() == 1)
$warning = $lang_fun['std_fun_added_successfully'];
else
stderr($lang_fun['std_error'],$lang_fun['std_error_happened']);
header("Location: " . get_protocol_prefix() . "$BASEURL/index.php");
}
}
if ($action == 'view')
{
?>
<html><head>
<title><?php echo $lang_fun['head_fun']; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="<?php echo get_font_css_uri()?>" type="text/css">
<link rel="stylesheet" href="<?php echo get_css_uri()."theme.css"?>" type="text/css">
<link rel="stylesheet" href="styles/curtain_imageresizer.css" type="text/css">
<script src="curtain_imageresizer.js" type="text/javascript"></script><style type="text/css">body {overflow-y:scroll; overflow-x: hidden}</style>
</head><body class='inframe'>
<?php
print(get_style_addicode());
if (!$row = $Cache->get_value('current_fun_content')){
$result = sql_query("SELECT fun.*, IF(ADDTIME(added, '1 0:0:0') < NOW(),true,false) AS neednew FROM fun WHERE status != 'banned' AND status != 'dull' ORDER BY added DESC LIMIT 1") or sqlerr(__FILE__,__LINE__);
$row = mysql_fetch_array($result);
$Cache->cache_value('current_fun_content', $row, 1043);
}
if ($row){
$title = $row['title'];
$username = get_username($row["userid"],false,true,true,true,false,false,"",false);
if ($CURUSER['timetype'] != 'timealive')
$time = $lang_fun['text_on'].$row['added'];
else $time = $lang_fun['text_blank'].gettime($row['added'],true,false);
$Cache->new_page('current_fun', 874, true);
if (!$Cache->get_page()){
$Cache->add_row();
$Cache->add_part();
print("<table border=0 cellspacing=0 cellpadding=2 width='100%'><tr><td class=shoutrow align=center><font class=big>".$title."</font><font class=small>".$lang_fun['text_posted_by']);
$Cache->end_part();
$Cache->add_part();
print("</font></td></tr><tr><td class=shoutrow>\n");
print(format_comment($row['body'], true, true, true)."</td></tr></table>");
$Cache->end_part();
$Cache->end_row();
$Cache->cache_page();
}
while($Cache->next_row()){
echo $Cache->next_part();
print($username.$time);
echo $Cache->next_part();
}
}
print("</body></html>");
}
if ($action == 'edit'){
$id = intval($_GET["id"] ?? 0);
int_check($id,true);
$res = sql_query("SELECT * FROM fun WHERE id=$id") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_array($res);
if (!$arr)
stderr($lang_fun['std_error'], $lang_fun['std_invalid_id']);
if ($arr["userid"] != $CURUSER["id"] && get_user_class() < $funmanage_class)
permissiondenied();
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$body = $_POST['body'];
if ($body == "")
stderr($lang_fun['std_error'],$lang_fun['std_body_is_empty']);
$title = htmlspecialchars($_POST['subject']);
if ($title == "")
stderr($lang_fun['std_error'],$lang_fun['std_title_is_empty']);
$body = sqlesc($body);
$title = sqlesc($title);
sql_query("UPDATE fun SET body=$body, title=$title WHERE id=".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('current_fun_content');
$Cache->delete_value('current_fun', true);
header("Location: " . get_protocol_prefix() . "$BASEURL/index.php");
}
else {
stdhead($lang_fun['head_edit_fun']);
begin_main_frame();
$title = $lang_fun['text_edit_fun'];
print("<form id=compose method=post name=\"compose\" action=?action=edit&id=".$id.">\n");
begin_compose($title, 'edit',$arr['body'], true, $arr['title']);
end_compose();
end_main_frame();
}
stdfoot();
}
if ($action == 'ban')
{
if (get_user_class() < $funmanage_class)
permissiondenied();
$id = intval($_GET["id"] ?? 0);
int_check($id,true);
$res = sql_query("SELECT * FROM fun WHERE id=$id") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_array($res);
if (!$arr)
stderr($lang_fun['std_error'], $lang_fun['std_invalid_id']);
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$banreason = htmlspecialchars($_POST['banreason'],ENT_QUOTES);
$title = htmlspecialchars($arr['title']);
if ($banreason == "")
stderr($lang_fun['std_error'],$lang_fun['std_reason_is_empty']);
sql_query("UPDATE fun SET status='banned' WHERE id=".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('current_fun_content');
$Cache->delete_value('current_fun', true);
$Cache->delete_value('current_fun_vote_count');
$Cache->delete_value('current_fun_vote_funny_count');
$subject = $lang_fun_target[get_user_lang($arr[userid])]['msg_fun_item_banned'];
$msg = $lang_fun_target[get_user_lang($arr[userid])]['msg_your_fun_item'].$title.$lang_fun_target[get_user_lang($arr[userid])]['msg_is_ban_by'].$CURUSER['username'].$lang_fun_target[get_user_lang($arr[userid])]['msg_reason'].$banreason;
sql_query("INSERT INTO messages (sender, subject, receiver, added, msg) VALUES(0, ".sqlesc($subject).", ".$arr['userid'].", '" . date("Y-m-d H:i:s") . "', " . sqlesc($msg) . ")") or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('user_'.$arr['userid'].'_unread_message_count');
$Cache->delete_value('user_'.$arr['userid'].'_inbox_count');
write_log("Fun item $id ($title) was banned by $CURUSER[username]. Reason: $banreason", 'normal');
stderr($lang_fun['std_success'], $lang_fun['std_fun_item_banned']);
}
else {
stderr($lang_fun['std_are_you_sure'], $lang_fun['std_only_against_rule']."<br /><form name=ban method=post action=fun.php?action=ban&id=".$id."><input type=hidden name=sure value=1>".$lang_fun['std_reason_required']."<input type=text style=\"width: 200px\" name=banreason><input type=submit value=".$lang_fun['submit_okay']."></form>", false);
}
}
function funreward($funvote, $totalvote, $title, $posterid, $bonus)
{
global $lang_fun_target, $lang_fun;
KPS("+",$bonus,$posterid);
$subject = $lang_fun_target[get_user_lang($posterid)]['msg_fun_item_reward'];
$msg = $funvote.$lang_fun_target[get_user_lang($posterid)]['msg_out_of'].$totalvote.$lang_fun_target[get_user_lang($posterid)]['msg_people_think'].$title.$lang_fun_target[get_user_lang($posterid)]['msg_is_fun'].$bonus.$lang_fun_target[get_user_lang($posterid)]['msg_bonus_as_reward'];
$sql = "INSERT INTO messages (sender, subject, receiver, added, msg) VALUES(0, ".sqlesc($subject).",". $posterid. ",'" . date("Y-m-d H:i:s") . "', " . sqlesc($msg) . ")";
sql_query($sql) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('user_'.$posterid.'_unread_message_count');
$Cache->delete_value('user_'.$posterid.'_inbox_count');
}
if ($action == 'vote')
{
$id = intval($_GET["id"] ?? 0);
int_check($id,true);
$res = sql_query("SELECT * FROM fun WHERE id=$id") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_array($res);
if (!$arr)
stderr($lang_fun['std_error'], $lang_fun['std_invalid_id']);
else {
$res = sql_query("SELECT * FROM funvotes WHERE funid=$id AND userid = $CURUSER[id]") or sqlerr(__FILE__,__LINE__);
$checkvote = mysql_fetch_array($res);
if ($checkvote)
stderr($lang_fun['std_error'], $lang_fun['std_already_vote']);
else {
if ($_GET["yourvote"] == 'dull')
$vote = 'dull';
else $vote = 'fun';
$sql = "INSERT INTO funvotes (funid, userid, added, vote) VALUES (".sqlesc($id).",".$CURUSER['id'].",".sqlesc(date("Y-m-d H:i:s")).",".sqlesc($vote).")";
sql_query($sql) or sqlerr(__FILE__,__LINE__);
KPS("+",$funboxvote_bonus,$CURUSER['id']); //voter gets 1.0 bonus per vote
$totalvote = $Cache->get_value('current_fun_vote_count');
if ($totalvote == ""){
$totalvote = get_row_count("funvotes", "WHERE funid = ".sqlesc($row['id']));
}
else $totalvote++;
$Cache->cache_value('current_fun_vote_count', $totalvote, 756);
$funvote = $Cache->get_value('current_fun_vote_funny_count');
if ($funvote == ""){
$funvote = get_row_count("funvotes", "WHERE funid = ".sqlesc($row['id'])." AND vote='fun'");
}
elseif($vote == 'fun')
$funvote++;
$Cache->cache_value('current_fun_vote_funny_count', $funvote, 756);
if ($totalvote) $ratio = $funvote / $totalvote; else $ratio = 1;
if ($totalvote >= 20){
if ($ratio > 0.75){
sql_query("UPDATE fun SET status = 'veryfunny' WHERE id = ".sqlesc($id));
if ($totalvote == 25) //Give fun item poster some bonus and write a message to him
funreward($funvote, $totalvote, $arr['title'], $arr['userid'], $funboxreward_bonus * 2);
if ($totalvote == 50)
funreward($funvote, $totalvote, $arr['title'], $arr['userid'], $funboxreward_bonus * 2);
if ($totalvote == 100)
funreward($funvote, $totalvote, $arr['title'], $arr['userid'], $funboxreward_bonus * 2);
if ($totalvote == 200)
funreward($funvote, $totalvote, $arr['title'], $arr['userid'], $funboxreward_bonus * 2);
}
elseif ($ratio > 0.5){
sql_query("UPDATE fun SET status = 'funny' WHERE id = ".sqlesc($id));
if ($totalvote == 25) //Give fun item poster some bonus and write a message to him
funreward($funvote, $totalvote, $arr['id'], $arr['userid'], $funboxreward_bonus);
if ($totalvote == 50)
funreward($funvote, $totalvote, $arr['id'], $arr['userid'], $funboxreward_bonus);
if ($totalvote == 100)
funreward($funvote, $totalvote, $arr['id'], $arr['userid'], $funboxreward_bonus);
if ($totalvote == 200)
funreward($funvote, $totalvote, $arr['id'], $arr['userid'], $funboxreward_bonus);
}
elseif ($ratio > 0.25){
sql_query("UPDATE fun SET status = 'notfunny' WHERE id = ".sqlesc($id));
}
else{
sql_query("UPDATE fun SET status = 'dull' WHERE id = ".sqlesc($id));
//write a message to fun item poster
$subject = $lang_fun_target[get_user_lang($arr['userid'])]['msg_fun_item_dull'];
$msg = ($totalvote - $funvote).$lang_fun_target[get_user_lang($arr['userid'])]['msg_out_of'].$totalvote.$lang_fun_target[get_user_lang($arr['userid'])]['msg_people_think'].$arr['title'].$lang_fun_target[get_user_lang($arr['userid'])]['msg_is_dull'];
$sql = "INSERT INTO messages (sender, subject, receiver, added, msg) VALUES(0, ".sqlesc($subject).",". $arr['userid'].", '" . date("Y-m-d H:i:s") . "', " . sqlesc($msg) . ")";
sql_query($sql) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('user_'.$arr['userid'].'_unread_message_count');
$Cache->delete_value('user_'.$arr['userid'].'_inbox_count');
}
}
}
}
}
?>
+57
View File
@@ -0,0 +1,57 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
loggedinorreturn();
parked();
$id = (int)$_GET["id"];
if (!$id)
die('Invalid id.');
$dlkey = $_GET["dlkey"];
if (!$dlkey)
die('Invalid key');
$res = sql_query("SELECT * FROM attachments WHERE id = ".sqlesc($id)." AND dlkey = ".sqlesc($dlkey)." LIMIT 1") or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_assoc($res);
if (!$row)
die('No attachment found.');
$filelocation = $httpdirectory_attachment."/".$row['location'];
if (!is_file($filelocation) || !is_readable($filelocation))
die('File not found or cannot be read.');
$f = fopen($filelocation, "rb");
if (!$f)
die("Cannot open file");
header("Content-Length: " . $row['filesize']);
header("Content-Type: application/octet-stream");
if ( str_replace("Gecko", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'])
{
header ("Content-Disposition: attachment; filename=\"$row[filename]\" ; charset=utf-8");
}
else if ( str_replace("Firefox", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
{
header ("Content-Disposition: attachment; filename=\"$row[filename]\" ; charset=utf-8");
}
else if ( str_replace("Opera", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
{
header ("Content-Disposition: attachment; filename=\"$row[filename]\" ; charset=utf-8");
}
else if ( str_replace("IE", "", $_SERVER['HTTP_USER_AGENT']) != $_SERVER['HTTP_USER_AGENT'] )
{
header ("Content-Disposition: attachment; filename=".str_replace("+", "%20", rawurlencode($row[filename])));
}
else
{
header ("Content-Disposition: attachment; filename=".str_replace("+", "%20", rawurlencode($row[filename])));
}
do
{
$s = fread($f, 4096);
print($s);
} while (!feof($f));
sql_query("UPDATE attachments SET downloads = downloads + 1 WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('attachment_'.$dlkey.'_content');
exit;
?>
+27
View File
@@ -0,0 +1,27 @@
<?php
require "../include/bittorrent.php";
require_once ("imdb/imdb.class.php");
dbconn();
//Send some headers to keep the user's browser from caching the response.
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
header("Cache-Control: no-cache, must-revalidate" );
header("Pragma: no-cache" );
header("Content-Type: text/xml; charset=utf-8");
$imdblink = $_GET['url'];
$mode = $_GET['type'];
$cache_stamp = $_GET['cache'];
$imdb_id = parse_imdb_id($imdblink);
$Cache->new_page('imdb_id_'.$imdb_id.'_'.$mode, 1296000, true);
if (!$Cache->get_page()){
$infoblock = getimdb($imdb_id, $cache_stamp, $mode);
if ($infoblock){
$Cache->add_whole_row();
print($infoblock);
$Cache->end_whole_row();
$Cache->cache_page();
echo $Cache->next_row();
}
}
else echo $Cache->next_row();
?>
+343
View File
@@ -0,0 +1,343 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
$brsectiontype = $browsecatmode;
$spsectiontype = $specialcatmode;
if ($enablespecial == 'yes')
$allowspecial = true;
else $allowspecial = false;
$showsubcat = (get_searchbox_value($brsectiontype, 'showsubcat') || ($allowspecial && get_searchbox_value($spsectiontype, 'showsubcat')));
$showsource = (get_searchbox_value($brsectiontype, 'showsource') || ($allowspecial && get_searchbox_value($spsectiontype, 'showsource'))); //whether show sources or not
$showmedium = (get_searchbox_value($brsectiontype, 'showmedium') || ($allowspecial && get_searchbox_value($spsectiontype, 'showmedium'))); //whether show media or not
$showcodec = (get_searchbox_value($brsectiontype, 'showcodec') || ($allowspecial && get_searchbox_value($spsectiontype, 'showcodec'))); //whether show codecs or not
$showstandard = (get_searchbox_value($brsectiontype, 'showstandard') || ($allowspecial && get_searchbox_value($spsectiontype, 'showstandard'))); //whether show standards or not
$showprocessing = (get_searchbox_value($brsectiontype, 'showprocessing') || ($allowspecial && get_searchbox_value($spsectiontype, 'showprocessing'))); //whether show processings or not
$showteam = (get_searchbox_value($brsectiontype, 'showteam') || ($allowspecial && get_searchbox_value($spsectiontype, 'showteam'))); //whether show teams or not
$showaudiocodec = (get_searchbox_value($brsectiontype, 'showaudiocodec') || ($allowspecial && get_searchbox_value($spsectiontype, 'showaudiocodec'))); //whether show audio codecs or not
$brcatsperror = get_searchbox_value($brsectiontype, 'catsperrow');
$catsperrow = get_searchbox_value($spsectiontype, 'catsperrow');
$catsperrow = (!$allowspecial ? $brcatsperror : ($catsperrow > $catsperrow ? $catsperrow : $catsperrow)); //show how many cats per line
$brcatpadding = get_searchbox_value($brsectiontype, 'catpadding');
$spcatpadding = get_searchbox_value($spsectiontype, 'catpadding');
$catpadding = (!$allowspecial ? $brcatpadding : ($brcatpadding < $spcatpadding ? $brcatpadding : $spcatpadding)); //padding space between categories in pixel
$brcats = genrelist($brsectiontype);
$spcats = genrelist($spsectiontype);
if ($showsubcat){
if ($showsource) $sources = searchbox_item_list("sources");
if ($showmedium) $media = searchbox_item_list("media");
if ($showcodec) $codecs = searchbox_item_list("codecs");
if ($showstandard) $standards = searchbox_item_list("standards");
if ($showprocessing) $processings = searchbox_item_list("processings");
if ($showteam) $teams = searchbox_item_list("teams");
if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs");
}
stdhead($lang_getrss['head_rss_feeds']);
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$allowed_showrows=array('10','20','30','40','50');
$link = get_protocol_prefix(). $BASEURL ."/torrentrss.php";
if (isset($_POST['showrows']) && in_array($_POST['showrows'], $allowed_showrows, 1))
$query[] = "rows=".(int)$_POST['showrows'];
else {
stdmsg($lang_getrss['std_error'],$lang_getrss['std_no_row']);
stdfoot();
die();
}
foreach ($brcats as $cat)
{
if (!empty($_POST["cat{$cat['id']}"]))
{
$query[] = "cat{$cat['id']}=1";
}
}
if ($enablespecial == 'yes')
{
foreach ($spcats as $cat)
{
if (!empty($_POST["cat{$cat['id']}"]))
{
$query[] = "cat{$cat['id']}=1";
}
}
}
if ($showsubcat){
if ($showsource)
foreach ($sources as $source)
{
if (!empty($_POST["sou{$source['id']}"]))
{
$query[] = "sou{$source['id']}=1";
}
}
if ($showmedium)
foreach ($media as $medium)
{
if (!empty($_POST["med{$medium['id']}"]))
{
$query[] = "med{$medium['id']}=1";
}
}
if ($showcodec)
foreach ($codecs as $codec)
{
if (!empty($_POST["cod{$codec['id']}"]))
{
$query[] = "cod{$codec['id']}=1";
}
}
if ($showstandard)
foreach ($standards as $standard)
{
if (!empty($_POST["sta{$standard['id']}"]))
{
$query[] = "sta{$standard['id']}=1";
}
}
if ($showprocessing)
foreach ($processings as $processing)
{
if (!empty($_POST["pro{$processing['id']}"]))
{
$query[] = "pro{$processing['id']}=1";
}
}
if ($showteam)
foreach ($teams as $team)
{
if (!empty($_POST["tea{$team['id']}"]))
{
$query[] = "tea{$team['id']}=1";
}
}
if ($showaudiocodec)
foreach ($audiocodecs as $audiocodec)
{
if (!empty($_POST["aud{$audiocodec['id']}"]))
{
$query[] = "aud{$audiocodec['id']}=1";
}
}
}
if (!empty($_POST["itemcategory"]))
{
$query[] = "icat=1";
}
if (!empty($_POST["itemsmalldescr"]))
{
$query[] = "ismalldescr=1";
}
if (!empty($_POST["itemsize"]))
{
$query[] = "isize=1";
}
if (!empty($_POST["itemuploader"]))
{
$query[] = "iuplder=1";
}
$searchstr = mysql_real_escape_string(trim($_POST["search"] ?? ''));
// if (empty($searchstr))
// unset($searchstr);
if ($searchstr)
{
$query[] = "search=".rawurlencode($searchstr);
if ($_POST["search_mode"]){
$search_mode = intval($_POST["search_mode"] ?? 0);
if (!in_array($search_mode,array(0,1,2)))
{
$search_mode = 0;
}
$query[] = "search_mode=".$search_mode;
}
}
$inclbookmarked=intval($_POST['inclbookmarked'] ?? 0);
if($inclbookmarked)
{
if (!in_array($inclbookmarked,array(0,1)))
{
$inclbookmarked = 0;
}
$addinclbm = "&inclbookmarked=".$inclbookmarked;
}
else
{
$addinclbm="";
}
$queries = implode("&", $query);
if ($queries)
$link .= "?".$queries;
$msg = $lang_getrss['std_use_following_url'] ."\n".$link."\n\n".$lang_getrss['std_utorrent_feed_url']."\n".$link."&linktype=dl&passkey=".$CURUSER['passkey'].$addinclbm;
stdmsg($lang_getrss['std_done'],format_comment($msg));
stdfoot();
die();
}
?>
<h1 align="center"><?php echo $lang_getrss['text_rss_feeds']?></h1>
<form method="post" action="getrss.php">
<table cellspacing="1" cellpadding="5" width="940">
<tr>
<td class="rowhead"><?php echo $lang_getrss['row_categories_to_retrieve']?>
</td>
<td class="rowfollow" align="left">
<?php
$categories = "<table><tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_category']."</b></td></tr><tr>";
$i = 0;
foreach ($brcats as $cat)//print category list of Torrents section
{
$numinrow = $i % $catsperrow;
$rownum = (int)($i / $catsperrow);
if ($i && $numinrow == 0){
$categories .= "</tr>".($brenablecatrow ? "<tr><td class=\"embedded\" align=\"left\"><b>".$brcatrow[$rownum]."</b></td></tr>" : "")."<tr>";
}
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"cat".$cat['id']."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[cat".$cat['id']."]") !== false ? " checked=\"checked\"" : "")." value='yes' />".return_category_image($cat['id'], "torrents.php?allsec=1&amp;")."</td>\n";
$i++;
}
$categories .= "</tr>";
if ($allowspecial) //print category list of Special section
{
$categories .= "<tr>";
$i = 0;
foreach ($spcats as $cat)
{
$numinrow = $i % $catsperrow;
$rownum = (int)($i / $catsperrow);
if ($i && $numinrow == 0){
$categories .= "</tr>".($spenablecatrow ? "<tr><td class=\"embedded\" align=\"left\"><b>".$spcatrow[$rownum]."</b></td></tr>" : "")."<tr>";
}
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"cat".$cat['id']."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[cat".$cat['id']."]") !== false ? " checked=\"checked\"" : "")." value='yes' />".return_category_image($cat['id'], "torrents.php?allsec=1&amp;")."</td>\n";
$i++;
}
$categories .= "</tr>";
}
if ($showsubcat)//Show subcategory (i.e. source, codecs) selections
{
if ($showsource){
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_source']."</b></td></tr><tr>";
$i = 0;
foreach ($sources as $source)
{
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"sou".$source['id']."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[sou".$source['id']."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$source['name']."</td>\n";
$i++;
}
$categories .= "</tr>";
}
if ($showmedium){
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_medium']."</b></td></tr><tr>";
$i = 0;
foreach ($media as $medium)
{
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"med".$medium['id']."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[med".$medium['id']."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$medium['name']."</td>\n";
$i++;
}
$categories .= "</tr>";
}
if ($showcodec){
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_codec']."</b></td></tr><tr>";
$i = 0;
foreach ($codecs as $codec)
{
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"cod".$codec['id']."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[cod".$codec['id']."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$codec['name']."</td>\n";
$i++;
}
$categories .= "</tr>";
}
if ($showaudiocodec){
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_audio_codec']."</b></td></tr><tr>";
$i = 0;
foreach ($audiocodecs as $audiocodec)
{
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"aud".$audiocodec['id']."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[aud".$audiocodec['id']."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$audiocodec['name']."</td>\n";
$i++;
}
$categories .= "</tr>";
}
if ($showstandard){
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_standard']."</b></td></tr><tr>";
$i = 0;
foreach ($standards as $standard)
{
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"sta".$standard['id']."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[sta".$standard['id']."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$standard['name']."</td>\n";
$i++;
}
$categories .= "</tr>";
}
if ($showprocessing){
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_processing']."</b></td></tr><tr>";
$i = 0;
foreach ($processings as $processing)
{
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"pro".$processing['id']."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[pro".$processing['id']."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$processing['name']."</td>\n";
$i++;
}
$categories .= "</tr>";
}
if ($showteam){
$categories .= "<tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_team']."</b></td></tr><tr>";
$i = 0;
foreach ($teams as $team)
{
$categories .= ($i && $i % $catsperrow == 0) ? "</tr><tr>" : "";
$categories .= "<td align=\"left\" class=\"bottom\" style=\"padding-bottom: 4px;padding-left: ".$catpadding."px\"><input name=\"tea".$team['id']."\" type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[tea".$team['id']."]") !== false ? " checked=\"checked\"" : "") . " value='yes' />".$team['name']."</td>\n";
$i++;
}
$categories .= "</tr>";
}
}
$categories .= "</table>";
print($categories);
?>
</td>
</tr>
<tr>
<td class="rowhead"><?php echo $lang_getrss['row_show_bookmarked']?>
</td>
<td class="rowfollow" align="left">
<input type="radio" name="inclbookmarked" id="inclbookmarked0" value="0" checked="checked" /><label for="inclbookmarked0"><?php echo $lang_getrss['text_all']?></label>&nbsp;<input type="radio" name="inclbookmarked" id="inclbookmarked1" value="1" /><label for="inclbookmarked1"><?php echo $lang_getrss['text_only_bookmarked']?></label><div><?php echo $lang_getrss['text_show_bookmarked_note']?></div>
</td>
</tr>
<tr>
<td class="rowhead"><?php echo $lang_getrss['row_item_title_type']?>
</td>
<td class="rowfollow" align="left">
<input type="checkbox" name="itemcategory" value="1" /><?php echo $lang_getrss['text_item_category']?>&nbsp;<input type="checkbox" name="itemtitle" checked="checked" disabled="disabled" /><?php echo $lang_getrss['text_item_title']?>&nbsp;<input type="checkbox" name="itemsmalldescr" value="1" /><?php echo $lang_getrss['text_item_small_description']?>&nbsp;<input type="checkbox" name="itemsize" value="1" /><?php echo $lang_getrss['text_item_size']?>&nbsp;<input type="checkbox" name="itemuploader" value="1" /><?php echo $lang_getrss['text_item_uploader']?>
</td>
</tr>
<tr><td class="rowhead"><?php echo $lang_getrss['row_rows_per_page']?></td><td class="rowfollow" align="left"><select name="showrows">
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
</select></td></tr>
<tr><td class="rowhead"><?php echo $lang_getrss['row_keyword']?></td>
<td class="rowfollow" align="left">
<input type="text" name="search" style="width: 200px;" /> <?php echo $lang_getrss['text_with']?>
<select name="search_mode" style="width: 60px;">
<option value="0"><?php echo $lang_getrss['select_and'] ?></option>
<option value="1" selected="selected"><?php echo $lang_getrss['select_or'] ?></option>
<option value="2"><?php echo $lang_getrss['select_exact'] ?></option>
</select>
<?php echo $lang_getrss['text_mode']?>
<div><?php echo $lang_getrss['text_keyword_note'] ?></div>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="<?php echo $lang_getrss['submit_generatte_rss_link']?>" />
</td>
</tr>
</table>
</form>
<?php
stdfoot();
+241
View File
@@ -0,0 +1,241 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
//Send some headers to keep the user's browser from caching the response.
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
header("Cache-Control: no-cache, must-revalidate" );
header("Pragma: no-cache" );
header("Content-Type: text/xml; charset=utf-8");
function maketable($res, $mode = 'seeding')
{
global $lang_getusertorrentlistajax,$CURUSER,$smalldescription_main;
switch ($mode)
{
case 'uploaded': {
$showsize = true;
$showsenum = true;
$showlenum = true;
$showuploaded = true;
$showdownloaded = false;
$showratio = false;
$showsetime = true;
$showletime = false;
$showcotime = false;
$showanonymous = true;
$columncount = 8;
break;
}
case 'seeding': {
$showsize = true;
$showsenum = true;
$showlenum = true;
$showuploaded = true;
$showdownloaded = true;
$showratio = true;
$showsetime = false;
$showletime = false;
$showcotime = false;
$showanonymous = false;
$columncount = 8;
break;
}
case 'leeching': {
$showsize = true;
$showsenum = true;
$showlenum = true;
$showuploaded = true;
$showdownloaded = true;
$showratio = true;
$showsetime = false;
$showletime = false;
$showcotime = false;
$showanonymous = false;
$columncount = 8;
break;
}
case 'completed': {
$showsize = false;
$showsenum = false;
$showlenum = false;
$showuploaded = true;
$showdownloaded = false;
$showratio = false;
$showsetime = true;
$showletime = true;
$showcotime = true;
$showanonymous = false;
$columncount = 8;
break;
}
case 'incomplete': {
$showsize = false;
$showsenum = false;
$showlenum = false;
$showuploaded = true;
$showdownloaded = true;
$showratio = true;
$showsetime = false;
$showletime = true;
$showcotime = false;
$showanonymous = false;
$columncount = 7;
break;
}
default: break;
}
$ret = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" width=\"800\"><tr><td class=\"colhead\" style=\"padding: 0px\">".$lang_getusertorrentlistajax['col_type']."</td><td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_name']."</td>".
($showsize ? "<td class=\"colhead\" align=\"center\"><img class=\"size\" src=\"pic/trans.gif\" alt=\"size\" title=\"".$lang_getusertorrentlistajax['title_size']."\" /></td>" : "").($showsenum ? "<td class=\"colhead\" align=\"center\"><img class=\"seeders\" src=\"pic/trans.gif\" alt=\"seeders\" title=\"".$lang_getusertorrentlistajax['title_seeders']."\" /></td>" : "").($showlenum ? "<td class=\"colhead\" align=\"center\"><img class=\"leechers\" src=\"pic/trans.gif\" alt=\"leechers\" title=\"".$lang_getusertorrentlistajax['title_leechers']."\" /></td>" : "").($showuploaded ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_uploaded']."</td>" : "") . ($showdownloaded ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_downloaded']."</td>" : "").($showratio ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_ratio']."</td>" : "").($showsetime ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_se_time']."</td>" : "").($showletime ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_le_time']."</td>" : "").($showcotime ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_time_completed']."</td>" : "").($showanonymous ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_anonymous']."</td>" : "")."</tr>\n";
while ($arr = mysql_fetch_assoc($res))
{
$catimage = htmlspecialchars($arr["image"]);
$catname = htmlspecialchars($arr["catname"]);
$sphighlight = get_torrent_bg_color($arr['sp_state']);
$sp_torrent = get_torrent_promotion_append($arr['sp_state']);
//torrent name
$dispname = $nametitle = htmlspecialchars($arr["torrentname"]);
$count_dispname=mb_strlen($dispname,"UTF-8");
$max_lenght_of_torrent_name=($CURUSER['fontsize'] == 'large' ? 70 : 80);
if($count_dispname > $max_lenght_of_torrent_name)
$dispname=mb_substr($dispname, 0, $max_lenght_of_torrent_name,"UTF-8") . "..";
if ($smalldescription_main == 'yes'){
//small description
$dissmall_descr = htmlspecialchars(trim($arr["small_descr"]));
$count_dissmall_descr=mb_strlen($dissmall_descr,"UTF-8");
$max_lenght_of_small_descr=80; // maximum length
if($count_dissmall_descr > $max_lenght_of_small_descr)
{
$dissmall_descr=mb_substr($dissmall_descr, 0, $max_lenght_of_small_descr,"UTF-8") . "..";
}
}
else $dissmall_descr == "";
$ret .= "<tr" . $sphighlight . "><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>".return_category_image($arr['category'], "torrents.php?allsec=1&amp;")."</td>\n" .
"<td class=\"rowfollow\" width=\"100%\" align=\"left\"><a href=\"".htmlspecialchars("details.php?id=".$arr[torrent]."&hit=1")."\" title=\"".$nametitle."\"><b>" . $dispname . "</b></a>". $sp_torrent .($dissmall_descr == "" ? "" : "<br />" . $dissmall_descr) . "</td>";
//size
if ($showsize)
$ret .= "<td class=\"rowfollow\" align=\"center\">". mksize_compact($arr['size'])."</td>";
//number of seeders
if ($showsenum)
$ret .= "<td class=\"rowfollow\" align=\"center\">".$arr['seeders']."</td>";
//number of leechers
if ($showlenum)
$ret .= "<td class=\"rowfollow\" align=\"center\">".$arr['leechers']."</td>";
//uploaded amount
if ($showuploaded){
$uploaded = mksize_compact($arr["uploaded"]);
$ret .= "<td class=\"rowfollow\" align=\"center\">".$uploaded."</td>";
}
//downloaded amount
if ($showdownloaded){
$downloaded = mksize_compact($arr["downloaded"]);
$ret .= "<td class=\"rowfollow\" align=\"center\">".$downloaded."</td>";
}
//ratio
if ($showratio){
if ($arr['downloaded'] > 0)
{
$ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3);
$ratio = "<font color=\"" . get_ratio_color($ratio) . "\">".$ratio."</font>";
}
elseif ($arr['uploaded'] > 0) $ratio = "Inf.";
else $ratio = "---";
$ret .= "<td class=\"rowfollow\" align=\"center\">".$ratio."</td>";
}
if ($showsetime){
$ret .= "<td class=\"rowfollow\" align=\"center\">".mkprettytime($arr['seedtime'])."</td>";
}
if ($showletime){
$ret .= "<td class=\"rowfollow\" align=\"center\">".mkprettytime($arr['leechtime'])."</td>";
}
if ($showcotime)
$ret .= "<td class=\"rowfollow\" align=\"center\">"."". str_replace("&nbsp;", "<br />", gettime($arr['completedat'],false)). "</td>";
if ($showanonymous)
$ret .= "<td class=\"rowfollow\" align=\"center\">".$arr['anonymous']."</td>";
$ret .="</tr>\n";
}
$ret .= "</table>\n";
return $ret;
}
$id = intval($_GET['userid'] ?? 0);
$type = $_GET['type'];
if (!in_array($type,array('uploaded','seeding','leeching','completed','incomplete')))
die;
if(get_user_class() < $torrenthistory_class && $id != $CURUSER["id"])
permissiondenied();
switch ($type)
{
case 'uploaded':
{
$res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, categories.name AS catname, categories.image, category, sp_state, size, snatched.seedtime, snatched.uploaded FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id AND snatched.userid=$id " . (($CURUSER["id"] != $id)?((get_user_class() < $viewanonymous_class) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__);
$count = mysql_num_rows($res);
if ($count > 0)
{
$torrentlist = maketable($res, 'uploaded');
}
break;
}
// Current Seeding
case 'seeding':
{
$res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.added DESC") or sqlerr();
$count = mysql_num_rows($res);
if ($count > 0){
$torrentlist = maketable($res, 'seeding');
}
break;
}
// Current Leeching
case 'leeching':
{
$res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.added DESC") or sqlerr();
$count = mysql_num_rows($res);
if ($count > 0){
$torrentlist = maketable($res, 'leeching');
}
break;
}
// Completed torrents
case 'completed':
{
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.completedat DESC") or sqlerr();
$count = mysql_num_rows($res);
if ($count > 0)
{
$torrentlist = maketable($res, 'completed');
}
break;
}
// Incomplete torrents
case 'incomplete':
{
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.startdat DESC") or sqlerr();
$count = mysql_num_rows($res);
if ($count > 0)
{
$torrentlist = maketable($res, 'incomplete');
}
break;
}
default:
{
$count = 0;
$torrentlist = "";
break;
}
}
if ($count)
echo "<b>".$count."</b>".$lang_getusertorrentlistajax['text_record'].add_s($count)."<br />".$torrentlist;
else
echo $lang_getusertorrentlistajax['text_no_record'];
?>
+677
View File
@@ -0,0 +1,677 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
parked();
if (get_user_class() < UC_SYSOP)
permissiondenied();
$lang_i18n = __();
function go_back()
{
global $lang_i18n;
stdmsg($lang_i18n['std_message'], $lang_i18n['std_click']."<a class=\"altlink\" href=\"i18n.php\">".$lang_i18n['std_here']."</a>".$lang_i18n['std_to_go_back']);
}
function yesorno($title, $name, $value, $note="")
{
global $lang_settings;
tr($title, "<input type='radio' id='".$name."yes' name='".$name."'".($value == "yes" ? " checked=\"checked\"" : "")." value='yes' /> <label for='".$name."yes'>".$lang_settings['text_yes']."</label> <input type='radio' id='".$name."no' name='".$name."'".($value == "no" ? " checked=\"checked\"" : "")." value='no' /> <label for='".$name."no'>".$lang_settings['text_no']."</label><br />".$note, 1);
}
function searchtable($title, $action, $opts = array()){
// global $lang_log;
print("<table border=1 cellspacing=0 width=940 cellpadding=5>\n");
print("<tr><td class=colhead align=left>".$title."</td></tr>\n");
print("<tr><td class=toolbox align=left><form method=\"get\" action='" . $_SERVER['PHP_SELF'] . "'>\n");
print("<input type=\"text\" name=\"query\" style=\"width:500px\" value=\"".($_GET['query'] ?? '')."\">\n");
print("<input type=\"hidden\" name=\"action\" value='".$action."'>&nbsp;&nbsp;");
print("<input type=submit value=\"给我搜\"></form>\n");
print("</td></tr></table><br />\n");
}
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'i18n';
$allowed_actions = array('saveI18n', 'import','mainsettings','smtpsettings','securitysettings','authoritysettings','tweaksettings', 'botsettings','codesettings','bonussettings','accountsettings','torrentsettings', 'attachmentsettings', 'advertisementsettings', 'savesettings_basic', 'savesettings_main','savesettings_smtp','savesettings_security','savesettings_authority','savesettings_tweak','savesettings_bot','savesettings_code','savesettings_bonus', 'savesettings_account','savesettings_torrent', 'savesettings_attachment', 'savesettings_advertisement', 'showmenu');
if (!in_array($action, $allowed_actions)) {
$action = 'i18n';
}
$notice = "<table cellspacing=\"0\" cellpadding=\"10\" width=\"940\"><tr><td colspan=\"2\" style='padding: 10px; background: black' align=\"center\">
<font color=\"white\">". __('internationalization_form') ."
</font></td></tr>";
if ($action == 'savesettings_main') // save main
{
stdhead($lang_settings['head_save_main_settings']);
$validConfig = array('site_online','max_torrent_size','announce_interval', 'annintertwoage', 'annintertwo', 'anninterthreeage', 'anninterthree', 'signup_timeout','minoffervotes','offervotetimeout','offeruptimeout','maxsubsize','postsperpage', 'topicsperpage', 'torrentsperpage', 'maxnewsnum','max_dead_torrent_time','maxusers','torrent_dir', 'iniupload','SITEEMAIL', 'ACCOUNTANTID', 'ALIPAYACCOUNT', 'PAYPALACCOUNT', 'SLOGAN', 'icplicense', 'autoclean_interval_one', 'autoclean_interval_two', 'autoclean_interval_three','autoclean_interval_four', 'autoclean_interval_five','reportemail','invitesystem','registration','showhotmovies','showclassicmovies','showimdbinfo', 'enablenfo', 'enableschool','restrictemail','showpolls','showstats','showlastxtorrents', 'showtrackerload','showshoutbox','showfunbox','showoffer','sptime','showhelpbox','enablebitbucket', 'smalldescription','altname','extforum','extforumurl','defaultlang','defstylesheet', 'donation','spsct','browsecat','specialcat','waitsystem','maxdlsystem','bitbucket','torrentnameprefix', 'showforumstats','verification','invite_count','invite_timeout', 'seeding_leeching_time_calc_start','startsubid', 'logo');
GetVar($validConfig);
unset($MAIN);
foreach($validConfig as $config) {
$MAIN[$config] = $$config;
}
WriteConfig('MAIN', $MAIN);
$Cache->delete_value('recent_news', true);
$Cache->delete_value('stats_users', true);
$Cache->delete_value('stats_torrents', true);
$Cache->delete_value('peers_count', true);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker MAIN settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
elseif ($action == 'savesettings_basic') // save basic
{
stdhead($lang_settings['head_save_basic_settings']);
$validConfig = array('SITENAME', 'BASEURL', 'announce_url', 'mysql_host', 'mysql_user', 'mysql_pass', 'mysql_db');
GetVar($validConfig);
if (!mysql_connect($mysql_host, $mysql_user, $mysql_pass)) {
stdmsg($lang_settings['std_error'], $lang_settings['std_mysql_connect_error'].$lang_settings['std_click']."<a class=\"altlink\" href=\"settings.php\">".$lang_settings['std_here']."</a>".$lang_settings['std_to_go_back']);
} else {
dbconn();
unset($BASIC);
foreach($validConfig as $config) {
$BASIC[$config] = $$config;
}
WriteConfig('BASIC', $BASIC);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker basic settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
}
elseif ($action == 'savesettings_code') // save database
{
stdhead($lang_settings['head_save_code_settings']);
$validConfig = array('mainversion','subversion','releasedate','website');
GetVar($validConfig);
unset($CODE);
foreach($validConfig as $config) {
$CODE[$config] = $$config;
}
WriteConfig('CODE', $CODE);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker code settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
elseif ($action == 'savesettings_bonus') // save bonus
{
stdhead($lang_settings['head_save_bonus_settings']);
$validConfig = array('donortimes','perseeding','maxseeding','tzero','nzero','bzero','l', 'uploadtorrent','uploadsubtitle','starttopic','makepost','addcomment','pollvote','offervote', 'funboxvote','saythanks','receivethanks','funboxreward','onegbupload','fivegbupload','tengbupload', 'ratiolimit','dlamountlimit','oneinvite','customtitle','vipstatus','bonusgift', 'basictax', 'taxpercentage', 'prolinkpoint', 'prolinktime');
GetVar($validConfig);
unset($BONUS);
foreach($validConfig as $config) {
$BONUS[$config] = $$config;
}
WriteConfig('BONUS', $BONUS);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker bonus settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
elseif ($action == 'savesettings_account') // save account
{
stdhead($lang_settings['head_save_account_settings']);
$validConfig = array('neverdelete', 'neverdeletepacked', 'deletepacked', 'deleteunpacked', 'deletenotransfer', 'deletenotransfertwo', 'deletepeasant', 'psdlone', 'psratioone', 'psdltwo', 'psratiotwo', 'psdlthree', 'psratiothree', 'psdlfour', 'psratiofour', 'psdlfive', 'psratiofive', 'putime', 'pudl', 'puprratio', 'puderatio', 'eutime', 'eudl', 'euprratio', 'euderatio', 'cutime', 'cudl', 'cuprratio', 'cuderatio', 'iutime', 'iudl', 'iuprratio', 'iuderatio', 'vutime', 'vudl', 'vuprratio', 'vuderatio', 'exutime', 'exudl', 'exuprratio', 'exuderatio', 'uutime', 'uudl', 'uuprratio', 'uuderatio', 'nmtime', 'nmdl', 'nmprratio', 'nmderatio', 'getInvitesByPromotion');
GetVar($validConfig);
unset($ACCOUNT);
foreach($validConfig as $config) {
$ACCOUNT[$config] = $$config;
}
WriteConfig('ACCOUNT', $ACCOUNT);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker account settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
elseif($action == 'savesettings_torrent') // save account
{
stdhead($lang_settings['head_save_torrent_settings']);
$validConfig = array('prorules', 'randomhalfleech','randomfree','randomtwoup','randomtwoupfree','randomtwouphalfdown','largesize', 'largepro','expirehalfleech','expirefree','expiretwoup','expiretwoupfree','expiretwouphalfleech', 'expirenormal','hotdays','hotseeder','halfleechbecome','freebecome','twoupbecome','twoupfreebecome', 'twouphalfleechbecome','normalbecome','uploaderdouble','deldeadtorrent', 'randomthirtypercentdown', 'thirtypercentleechbecome', 'expirethirtypercentleech');
GetVar($validConfig);
unset($TORRENT);
foreach($validConfig as $config) {
$TORRENT[$config] = $$config;
}
WriteConfig('TORRENT', $TORRENT);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker torrent settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
elseif ($action == 'savesettings_smtp') // save smtp
{
stdhead($lang_settings['head_save_smtp_settings']);
$validConfig = array('smtptype', 'emailnotify');
GetVar($validConfig);
if ($smtptype == 'advanced') {
$validConfig = array_merge($validConfig, array('smtp_host','smtp_port','smtp_from'));
} elseif ($smtptype == 'external') {
$validConfig = array_merge($validConfig, array('smtpaddress','smtpport','accountname','accountpassword'));
}
GetVar($validConfig);
unset($SMTP);
foreach($validConfig as $config) {
$SMTP[$config] = $$config;
}
WriteConfig('SMTP', $SMTP);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker SMTP settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
elseif ($action == 'savesettings_security') // save security
{
stdhead($lang_settings['head_save_security_settings']);
$validConfig = array('securelogin', 'securetracker', 'https_announce_url','iv','maxip','maxloginattempts','changeemail','cheaterdet','nodetect');
GetVar($validConfig);
unset($SECURITY);
foreach($validConfig as $config) {
$SECURITY[$config] = $$config;
}
WriteConfig('SECURITY', $SECURITY);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker SECURITY settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
elseif ($action == 'savesettings_authority') // save user authority
{
stdhead($lang_settings['head_save_authority_settings']);
$validConfig = array('defaultclass','staffmem','newsmanage','newfunitem','funmanage','sbmanage','pollmanage','applylink', 'linkmanage', 'postmanage','commanage','forummanage','viewuserlist','torrentmanage','torrentsticky', 'torrentonpromotion', 'askreseed', 'viewnfo', 'torrentstructure','sendinvite','viewhistory','topten','log','confilog','userprofile', 'torrenthistory','prfmanage', 'cruprfmanage','uploadsub','delownsub','submanage','updateextinfo', 'viewanonymous','beanonymous','addoffer','offermanage', 'upload','uploadspecial','movetorrent','chrmanage','viewinvite', 'buyinvite','seebanned','againstoffer','userbar');
GetVar($validConfig);
unset($AUTHORITY);
foreach($validConfig as $config) {
$AUTHORITY[$config] = $$config;
}
WriteConfig('AUTHORITY', $AUTHORITY);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker USER AUTHORITY settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
elseif ($action == 'savesettings_tweak') // save tweak
{
stdhead($lang_settings['head_save_tweak_settings']);
$validConfig = array('where','iplog1','bonus','datefounded', 'enablelocation', 'titlekeywords', 'metakeywords', 'metadescription', 'enablesqldebug', 'sqldebug', 'cssdate', 'enabletooltip', 'prolinkimg', 'analyticscode');
GetVar($validConfig);
unset($TWEAK);
foreach($validConfig as $config) {
$TWEAK[$config] = $$config;
}
WriteConfig('TWEAK', $TWEAK);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker TWEAK settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
elseif ($action == 'savesettings_attachment') // save attachment
{
stdhead($lang_settings['head_save_attachment_settings']);
$validConfig = array('enableattach','classone','countone','sizeone', 'extone', 'classtwo','counttwo','sizetwo', 'exttwo', 'classthree','countthree','sizethree', 'extthree', 'classfour','countfour','sizefour', 'extfour', 'savedirectory', 'httpdirectory', 'savedirectorytype', 'thumbnailtype', 'thumbquality', 'thumbwidth', 'thumbheight', 'watermarkpos', 'watermarkwidth', 'watermarkheight', 'watermarkquality', 'altthumbwidth', 'altthumbheight');
GetVar($validConfig);
unset($ATTACHMENT);
foreach($validConfig as $config) {
$ATTACHMENT[$config] = $$config;
}
WriteConfig('ATTACHMENT', $ATTACHMENT);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker ATTACHMENT settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
elseif ($action == 'savesettings_advertisement') // save advertisement
{
stdhead($lang_settings['head_save_advertisement_settings']);
$validConfig = array('enablead', 'enablenoad', 'noad', 'enablebonusnoad', 'bonusnoad', 'bonusnoadpoint', 'bonusnoadtime', 'adclickbonus');
GetVar($validConfig);
unset($ADVERTISEMENT);
foreach($validConfig as $config) {
$ADVERTISEMENT[$config] = $$config;
}
WriteConfig('ADVERTISEMENT', $ADVERTISEMENT);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker ADVERTISEMENT settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
elseif ($action == 'tweaksettings') // tweak settings
{
stdhead($lang_settings['head_tweak_settings']);
print ($notice);
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_tweak' />");
yesorno($lang_settings['row_save_user_location'], 'where', $TWEAK["where"], $lang_settings['text_save_user_location_note']);
yesorno($lang_settings['row_log_user_ips'], 'iplog1', $TWEAK["iplog1"], $lang_settings['text_store_user_ips_note']);
tr($lang_settings['row_kps_enabled'],"<input type='radio' id='bonusenable' name='bonus'" . ($TWEAK["bonus"] == "enable" ? " checked='checked'" : "") . " value='enable' /> <label for='bonusenable'>".$lang_settings['text_enabled']."</label> <input type='radio' id='bonusdisablesave' name='bonus'" . ($TWEAK["bonus"] == "disablesave" ? " checked='checked'" : "") . " value='disablesave' /> <label for='bonusdisablesave'>".$lang_settings['text_disabled_but_save']."</label> <input type='radio' id='bonusdisable' name='bonus'" . ($TWEAK["bonus"] == "disable" ? " checked='checked'" : "") . " value='disable' /> <label for='bonusdisable'>".$lang_settings['text_disabled_no_save']."</label> <br />".$lang_settings['text_kps_note'], 1);
yesorno($lang_settings['row_enable_location'], 'enablelocation', $TWEAK["enablelocation"], $lang_settings['text_enable_location_note']);
yesorno($lang_settings['row_enable_tooltip'], 'enabletooltip', $TWEAK["enabletooltip"], $lang_settings['text_enable_tooltip_note']);
tr($lang_settings['row_title_keywords'],"<input type='text' style=\"width: 300px\" name='titlekeywords' value='".($TWEAK["titlekeywords"] ? $TWEAK["titlekeywords"] : '')."' /> <br />".$lang_settings['text_title_keywords_note'], 1);
tr($lang_settings['row_promotion_link_example_image'],"<input type='text' style=\"width: 300px\" name='prolinkimg' value='".($TWEAK["prolinkimg"] ? $TWEAK["prolinkimg"] : 'pic/prolink.png')."' /> <br />".$lang_settings['text_promotion_link_example_note'], 1);
tr($lang_settings['row_meta_keywords'],"<input type='text' style=\"width: 300px\" name='metakeywords' value='".($TWEAK["metakeywords"] ? $TWEAK["metakeywords"] : '')."' /> <br />".$lang_settings['text_meta_keywords_note'], 1);
tr($lang_settings['row_meta_description'],"<textarea cols=\"100\" style=\"width: 450px;\" rows=\"5\" name='metadescription'>".($TWEAK["metadescription"] ? $TWEAK["metadescription"] : '')."</textarea> <br />".$lang_settings['text_meta_description_note'], 1);
tr($lang_settings['row_web_analytics_code'],"<textarea cols=\"100\" style=\"width: 450px;\" rows=\"5\" name='analyticscode'>".($TWEAK["analyticscode"] ? $TWEAK["analyticscode"] : '')."</textarea> <br />".$lang_settings['text_web_analytics_code_note'], 1);
tr($lang_settings['row_see_sql_debug'], "<input type='checkbox' name='enablesqldebug' value='yes'".($TWEAK['enablesqldebug'] == 'yes' ? " checked='checked'" : "")." />".$lang_settings['text_allow'].classlist('sqldebug',UC_STAFFLEADER,$TWEAK['sqldebug'], UC_MODERATOR).$lang_settings['text_see_sql_list'].get_user_class_name(UC_SYSOP,false,true,true),1);
tr($lang_settings['row_tracker_founded_date'],"<input type='text' style=\"width: 300px\" name=datefounded value='".($TWEAK["datefounded"] ? $TWEAK["datefounded"] : '2007-12-24')."'> <br />".$lang_settings['text_tracker_founded_date_note'], 1);
tr($lang_settings['row_css_date'],"<input type='text' style=\"width: 300px\" name=cssdate value='".($TWEAK["cssdate"] ? $TWEAK["cssdate"] : '')."'> <br />".$lang_settings['text_css_date'], 1);
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("</form>");
}
elseif ($action == 'smtpsettings') // stmp settings
{
stdhead($lang_settings['head_smtp_settings']);
print ($notice);
print("<tbody>");
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_smtp'>");
yesorno($lang_settings['row_enable_email_notification'], 'emailnotify', $SMTP["emailnotify"], $lang_settings['text_email_notification_note']);
$smtp_select = "<input type=\"radio\" name=\"smtptype\" value=\"default\" onclick=\"document.getElementById('smtp_advanced').style.display='none'; document.getElementById('smtp_external').style.display='none';\"".($SMTP['smtptype'] == "default" ? " checked" : "")."> ". $lang_settings['text_smtp_default'] . "<br /><input type=\"radio\" name=\"smtptype\" value=\"advanced\" onclick=\"document.getElementById('smtp_advanced').style.display=''; document.getElementById('smtp_external').style.display='none';\"".($SMTP['smtptype'] == "advanced" ? " checked" : "")."> " . $lang_settings['text_smtp_advanced']."<br /><input type=\"radio\" name=\"smtptype\" value=\"external\" onclick=\"document.getElementById('smtp_advanced').style.display='none'; document.getElementById('smtp_external').style.display='';\"".($SMTP['smtptype'] == "external" ? " checked" : "")."> " . $lang_settings['text_smtp_external']."<br /><input type=\"radio\" name=\"smtptype\" value=\"none\" onclick=\"document.getElementById('smtp_advanced').style.display='none'; document.getElementById('smtp_external').style.display='none';\"".($SMTP['smtptype'] == "none" ? " checked" : "")."> " . $lang_settings['text_smtp_none'];
tr($lang_settings['row_mail_function_type'], $smtp_select, 1);
print("</tbody><tbody id=\"smtp_advanced\"".($SMTP['smtptype'] == "advanced" ? "" : " style=\"display: none;\"").">");
print("<tr><td colspan=2 align=center><b>".$lang_settings['text_setting_for_advanced_type']."</b></td></tr>");
tr($lang_settings['row_smtp_host'],"<input type='text' style=\"width: 300px\" name=smtp_host value='".($SMTP['smtp_host'] ? $SMTP['smtp_host'] : "localhost")."'> ".$lang_settings['text_smtp_host_note'], 1);
tr($lang_settings['row_smtp_port'],"<input type='text' style=\"width: 300px\" name=smtp_port value='".($SMTP['smtp_port'] ? $SMTP['smtp_port'] : "25")."'> ".$lang_settings['text_smtp_port_note'], 1);
if (strtoupper(substr(PHP_OS,0,3)=='WIN'))
tr($lang_settings['row_smtp_sendmail_from'], "<input type='text' style=\"width: 300px\" name=smtp_from value='".($SMTP['smtp_from'] ? $SMTP['smtp_from'] : $MAIN["SITEEMAIL"])."'> ".$lang_settings['text_smtp_sendmail_from_note'].$MAIN["SITEEMAIL"], 1);
else
tr($lang_settings['row_smtp_sendmail_path'], $lang_settings['text_smtp_sendmail_path_note'], 1);
print("</tbody><tbody id=\"smtp_external\"".($SMTP['smtptype'] == "external" ? "" : " style=\"display: none;\"").">");
print("<tr><td colspan=2 align=center><b>".$lang_settings['text_setting_for_external_type']."</b></td></tr>");
tr($lang_settings['row_outgoing_mail_address'], "<input type=text name=smtpaddress style=\"width: 300px\" ".(!empty($SMTP['smtpaddress']) ? "value=\"".$SMTP['smtpaddress']."\"" : "")."> ".$lang_settings['text_outgoing_mail_address_note'], 1);
tr($lang_settings['row_outgoing_mail_port'], "<input type=text name=smtpport style=\"width: 300px\" ".(!empty($SMTP['smtpport']) ? "value=\"".$SMTP['smtpport']."\"" : "")."> ".$lang_settings['text_outgoing_mail_port_note'], 1);
tr($lang_settings['row_smtp_account_name'], "<input type=text name=accountname style=\"width: 300px\" ".(!empty($SMTP['accountname']) ? "value=\"".$SMTP['accountname']."\"" : "")."> ".$lang_settings['text_smtp_account_name_note'], 1);
tr($lang_settings['row_smtp_account_password'], "<input type=password name=accountpassword style=\"width: 300px\" ".(!empty($SMTP['accountpassword']) ? "value=\"".$SMTP['accountpassword']."\"" : "")."> ".$lang_settings['text_smtp_account_password_note'], 1);
print("</tbody><tbody>");
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("<tr><td colspan=2 align=center>".$lang_settings['text_mail_test_note']."<a href=\"mailtest.php\" target=\"_blank\"><b>".$lang_settings['text_here']."</b></a></td></tr>");
print ("</form>");
print("</tbody>");
}
elseif ($action == 'securitysettings') //security settings
{
stdhead($lang_settings['head_security_settings']);
print ($notice);
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_security'>");
tr($lang_settings['row_enable_ssl'],"<input type='radio' name='securelogin'" . ($SECURITY["securelogin"] == "yes" ? " checked" : "") . " value='yes'> ".$lang_settings['text_yes']. " <input type='radio' name='securelogin'" . ($SECURITY["securelogin"] == "no" ? " checked" : "") . " value='no'> ".$lang_settings['text_no']. " <input type='radio' name='securelogin'" . ($SECURITY["securelogin"] == "op" ? " checked" : "") . " value='op'> ".$lang_settings['text_optional']."<br />".$lang_settings['text_ssl_note'], 1);
tr($lang_settings['row_enable_ssl_tracker'],"<input type='radio' name='securetracker'" . ($SECURITY["securetracker"] == "yes" ? " checked" : "") . " value='yes'> ".$lang_settings['text_yes']. " <input type='radio' name='securetracker'" . ($SECURITY["securetracker"] == "no" ? " checked" : "") . " value='no'> ".$lang_settings['text_no']. " <input type='radio' name='securetracker'" . ($SECURITY["securetracker"] == "op" ? " checked" : "") . " value='op'> ".$lang_settings['text_optional']."<br />".$lang_settings['text_ssl_note'], 1);
tr($lang_settings['row_https_announce_url'],"<input type='text' style=\"width: 300px\" name=https_announce_url value='".($SECURITY["https_announce_url"] ? $SECURITY["https_announce_url"] : "")."'> ".$lang_settings['text_https_announce_url_note'] . $_SERVER["HTTP_HOST"]."/announce.php", 1);
yesorno($lang_settings['row_enable_image_verification'], 'iv', $SECURITY["iv"], $lang_settings['text_image_verification_note']);
yesorno($lang_settings['row_allow_email_change'], 'changeemail', $SECURITY["changeemail"], $lang_settings['text_email_change_note']);
tr($lang_settings['row_cheater_detection_level'],"<select name='cheaterdet'><option value=0 " . ($SECURITY["cheaterdet"] == 0 ? " selected" : "") . "> ".$lang_settings['select_none']." </option><option value=1 " . ($SECURITY["cheaterdet"] == 1 ? " selected" : "") . "> ".$lang_settings['select_conservative']." </option><option value=2 " . ($SECURITY["cheaterdet"] == 2 ? " selected" : "") . "> ".$lang_settings['select_normal']." </option><option value=3 " . ($SECURITY["cheaterdet"] == 3 ? " selected" : "") . "> ".$lang_settings['select_strict']." </option><option value=4 " . ($SECURITY["cheaterdet"] == 4 ? " selected" : "") . "> ".$lang_settings['select_paranoid']." </option></select> ".$lang_settings['text_cheater_detection_level_note']."<br />".$lang_settings['text_never_suspect'].classlist('nodetect',$AUTHORITY['staffmem'],$SECURITY['nodetect']).$lang_settings['text_or_above'].get_user_class_name(UC_UPLOADER,false,true,true).".", 1);
tr($lang_settings['row_max_ips'],"<input type='text' style=\"width: 300px\" name=maxip value='" . ($SECURITY["maxip"] ? $SECURITY["maxip"] : "1")."'> ".$lang_settings['text_max_ips_note'], 1);
tr($lang_settings['row_max_login_attemps'],"<input type='text' style=\"width: 300px\" name=maxloginattempts value='" . ($SECURITY["maxloginattempts"] ? $SECURITY["maxloginattempts"] : "7")."'> ".$lang_settings['text_max_login_attemps_note'], 1);
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("</form>");
}
elseif ($action == 'authoritysettings') //Authority settings
{
stdhead($lang_settings['head_authority_settings']);
print ($notice);
$maxclass = UC_SYSOP;
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_authority'>");
tr($lang_settings['row_default_class'], $lang_settings['text_default_user_class'].classlist('defaultclass',UC_STAFFLEADER,$AUTHORITY['defaultclass']).$lang_settings['text_default'].get_user_class_name(UC_USER,false,true,true).$lang_settings['text_default_class_note'], 1);
tr($lang_settings['row_staff_member'], $lang_settings['text_minimum_class'].classlist('staffmem',UC_STAFFLEADER,$AUTHORITY['staffmem']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_staff_member_note'], 1);
tr($lang_settings['row_news_management'], $lang_settings['text_minimum_class'].classlist('newsmanage',$maxclass,$AUTHORITY['newsmanage']).$lang_settings['text_default'].get_user_class_name(UC_ADMINISTRATOR,false,true,true).$lang_settings['text_news_management_note'],1);
tr($lang_settings['row_post_funbox_item'], $lang_settings['text_minimum_class'].classlist('newfunitem',$maxclass,$AUTHORITY['newfunitem']).$lang_settings['text_default'].get_user_class_name(UC_USER,false,true,true).$lang_settings['text_post_funbox_item_note'],1);
tr($lang_settings['row_funbox_management'], $lang_settings['text_minimum_class']. classlist('funmanage',$maxclass,$AUTHORITY['funmanage']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_funbox_management_note'],1);
tr($lang_settings['row_shoutbox_management'], $lang_settings['text_minimum_class']. classlist('sbmanage',$maxclass,$AUTHORITY['sbmanage']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_shoutbox_management_note'],1);
tr($lang_settings['row_poll_management'], $lang_settings['text_minimum_class'].classlist('pollmanage',$maxclass,$AUTHORITY['pollmanage']).$lang_settings['text_default'].get_user_class_name(UC_ADMINISTRATOR,false,true,true).$lang_settings['text_poll_management_note'],1);
tr($lang_settings['row_apply_for_links'], $lang_settings['text_minimum_class'].classlist('applylink',$maxclass,$AUTHORITY['applylink']).$lang_settings['text_default'].get_user_class_name(UC_USER,false,true,true).$lang_settings['text_apply_for_links_note'],1);
tr($lang_settings['row_link_management'], $lang_settings['text_minimum_class'].classlist('linkmanage',$maxclass,$AUTHORITY['linkmanage']).$lang_settings['text_default'].get_user_class_name(UC_ADMINISTRATOR,false,true,true).$lang_settings['text_link_management_note'],1);
tr($lang_settings['row_forum_post_management'], $lang_settings['text_minimum_class'].classlist('postmanage',$maxclass,$AUTHORITY['postmanage']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_forum_post_management_note'],1);
tr($lang_settings['row_comment_management'], $lang_settings['text_minimum_class'].classlist('commanage',$maxclass,$AUTHORITY['commanage']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_comment_management_note'],1);
tr($lang_settings['row_forum_management'], $lang_settings['text_minimum_class'].classlist('forummanage',$maxclass,$AUTHORITY['forummanage']).$lang_settings['text_default'].get_user_class_name(UC_ADMINISTRATOR,false,true,true).$lang_settings['text_forum_management_note'],1);
tr($lang_settings['row_view_userlist'], $lang_settings['text_minimum_class'].classlist('viewuserlist',$maxclass,$AUTHORITY['viewuserlist']).$lang_settings['text_default'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_view_userlist_note'],1);
tr($lang_settings['row_torrent_management'], $lang_settings['text_minimum_class'].classlist('torrentmanage',$maxclass,$AUTHORITY['torrentmanage']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_torrent_management_note'], 1);
tr($lang_settings['row_torrent_sticky'], $lang_settings['text_minimum_class'].classlist('torrentsticky',$maxclass,$AUTHORITY['torrentsticky']).$lang_settings['text_default'].get_user_class_name(UC_ADMINISTRATOR,false,true,true).$lang_settings['text_torrent_sticky_note'],1);
tr($lang_settings['row_torrent_on_promotion'], $lang_settings['text_minimum_class'].classlist('torrentonpromotion',$maxclass,$AUTHORITY['torrentonpromotion'] ?? '').$lang_settings['text_default'].get_user_class_name(UC_ADMINISTRATOR,false,true,true).$lang_settings['text_torrent_promotion_note'],1);
tr($lang_settings['row_ask_for_reseed'], $lang_settings['text_minimum_class'].classlist('askreseed',$maxclass,$AUTHORITY['askreseed']).$lang_settings['text_default'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_ask_for_reseed_note'],1);
tr($lang_settings['row_view_nfo'], $lang_settings['text_minimum_class'].classlist('viewnfo',$maxclass,$AUTHORITY['viewnfo']).$lang_settings['text_default'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_view_nfo_note'],1);
tr($lang_settings['row_view_torrent_structure'], $lang_settings['text_minimum_class'].classlist('torrentstructure',$maxclass,$AUTHORITY['torrentstructure']).$lang_settings['text_default'].get_user_class_name(UC_ULTIMATE_USER,false,true,true).$lang_settings['text_view_torrent_structure_note'],1);
tr($lang_settings['row_send_invite'], $lang_settings['text_minimum_class'].classlist('sendinvite',$maxclass,$AUTHORITY['sendinvite']).$lang_settings['text_default'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_send_invite_note'],1);
tr($lang_settings['row_view_history'], $lang_settings['text_minimum_class'].classlist('viewhistory',$maxclass,$AUTHORITY['viewhistory']).$lang_settings['text_default'].get_user_class_name(UC_VETERAN_USER,false,true,true).$lang_settings['text_view_history_note'],1);
tr($lang_settings['row_view_topten'], $lang_settings['text_minimum_class'].classlist('topten',$maxclass,$AUTHORITY['topten']).$lang_settings['text_default'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_view_topten_note'],1);
tr($lang_settings['row_view_general_log'], $lang_settings['text_minimum_class'].classlist('log',$maxclass,$AUTHORITY['log']).$lang_settings['text_default'].get_user_class_name(UC_INSANE_USER,false,true,true).$lang_settings['text_view_general_log_note'],1);
tr($lang_settings['row_view_confidential_log'], $lang_settings['text_minimum_class'].classlist('confilog',$maxclass,$AUTHORITY['confilog']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_view_confidential_log_note'],1);
tr($lang_settings['row_view_user_confidential'], $lang_settings['text_minimum_class'].classlist('userprofile',$maxclass,$AUTHORITY['userprofile']).$lang_settings['text_default'].get_user_class_name(UC_ADMINISTRATOR,false,true,true).$lang_settings['text_view_user_confidential_note'],1);
tr($lang_settings['row_view_user_torrent'], $lang_settings['text_minimum_class'].classlist('torrenthistory',$maxclass,$AUTHORITY['torrenthistory']).$lang_settings['text_default'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_view_user_torrent_note'],1);
tr($lang_settings['row_general_profile_management'], $lang_settings['text_minimum_class'].classlist('prfmanage',$maxclass,$AUTHORITY['prfmanage']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_general_profile_management_note'],1);
tr($lang_settings['row_crucial_profile_management'], $lang_settings['text_minimum_class'].classlist('cruprfmanage',$maxclass,$AUTHORITY['cruprfmanage']).$lang_settings['text_default'].get_user_class_name(UC_ADMINISTRATOR,false,true,true).$lang_settings['text_crucial_profile_management_note'].get_user_class_name(UC_STAFFLEADER,false,true,true).$lang_settings['text_can_manage_donation'],1);
tr($lang_settings['row_upload_subtitle'], $lang_settings['text_minimum_class'].classlist('uploadsub',$maxclass,$AUTHORITY['uploadsub']).$lang_settings['text_default'].get_user_class_name(UC_USER,false,true,true).$lang_settings['text_upload_subtitle_note'],1);
tr($lang_settings['row_delete_own_subtitle'], $lang_settings['text_minimum_class'].classlist('delownsub',$maxclass,$AUTHORITY['delownsub']).$lang_settings['text_default'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_delete_own_subtitle_note'],1);
tr($lang_settings['row_subtitle_management'], $lang_settings['text_minimum_class'].classlist('submanage',$maxclass,$AUTHORITY['submanage']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_subtitle_management'],1);
tr($lang_settings['row_update_external_info'], $lang_settings['text_minimum_class'].classlist('updateextinfo',$maxclass,$AUTHORITY['updateextinfo']).$lang_settings['text_default'].get_user_class_name(UC_EXTREME_USER,false,true,true).$lang_settings['text_update_external_info_note'],1);
tr($lang_settings['row_view_anonymous'], $lang_settings['text_minimum_class'].classlist('viewanonymous',$maxclass,$AUTHORITY['viewanonymous']).$lang_settings['text_default'].get_user_class_name(UC_UPLOADER,false,true,true).$lang_settings['text_view_anonymous_note'],1);
tr($lang_settings['row_be_anonymous'], $lang_settings['text_minimum_class'].classlist('beanonymous',$maxclass,$AUTHORITY['beanonymous']).$lang_settings['text_default'].get_user_class_name(UC_CRAZY_USER,false,true,true).$lang_settings['text_be_anonymous_note'],1);
tr($lang_settings['row_add_offer'], $lang_settings['text_minimum_class'].classlist('addoffer',$maxclass,$AUTHORITY['addoffer']).$lang_settings['text_default'].get_user_class_name(UC_PEASANT,false,true,true).$lang_settings['text_add_offer_note'], 1);
tr($lang_settings['row_offer_management'], $lang_settings['text_minimum_class'].classlist('offermanage',$maxclass,$AUTHORITY['offermanage']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_offer_management_note'],1);
tr($lang_settings['row_upload_torrent'], $lang_settings['text_minimum_class'].classlist('upload',$maxclass,$AUTHORITY['upload']).$lang_settings['text_default'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_upload_torrent_note'], 1);
if (THISTRACKER == "HDStar")
tr($lang_settings['row_upload_special_torrent'], $lang_settings['text_minimum_class'].classlist('uploadspecial',$maxclass,$AUTHORITY['uploadspecial']).$lang_settings['text_default'].get_user_class_name(UC_UPLOADER,false,true,true).$lang_settings['text_upload_special_torrent_note'],1);
if (THISTRACKER == "HDStar")
tr($lang_settings['row_move_torrent'], $lang_settings['text_minimum_class'].classlist('movetorrent',$maxclass,$AUTHORITY['movetorrent']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_move_torrent_note'],1);
tr($lang_settings['row_chronicle_management'], $lang_settings['text_minimum_class'].classlist('chrmanage',$maxclass,$AUTHORITY['chrmanage']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_chronicle_management_note'],1);
tr($lang_settings['row_view_invite'], $lang_settings['text_minimum_class'].classlist('viewinvite',$maxclass,$AUTHORITY['viewinvite']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_view_invite_note'],1);
tr($lang_settings['row_buy_invites'], $lang_settings['text_minimum_class'].classlist('buyinvite',$maxclass,$AUTHORITY['buyinvite']).$lang_settings['text_default'].get_user_class_name(UC_INSANE_USER,false,true,true).$lang_settings['text_buy_invites_note'],1);
tr($lang_settings['row_see_banned_torrents'], $lang_settings['text_minimum_class'].classlist('seebanned',$maxclass,$AUTHORITY['seebanned']).$lang_settings['text_default'].get_user_class_name(UC_UPLOADER,false,true,true).$lang_settings['text_see_banned_torrents_note'],1);
tr($lang_settings['row_vote_against_offers'], $lang_settings['text_minimum_class'].classlist('againstoffer',$maxclass,$AUTHORITY['againstoffer']).$lang_settings['text_default'].get_user_class_name(UC_USER,false,true,true).$lang_settings['text_vote_against_offers_note'],1);
tr($lang_settings['row_allow_userbar'], $lang_settings['text_minimum_class'].classlist('userbar',$maxclass,$AUTHORITY['userbar']).$lang_settings['text_default'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_allow_userbar_note'],1);
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("</form>");
}
elseif ($action == 'basicsettings') // basic settings
{
stdhead($lang_settings['head_basic_settings']);
print ($notice);
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_basic'>");
tr($lang_settings['row_site_name'],"<input type='text' style=\"width: 300px\" name=SITENAME value='".($BASIC["SITENAME"] ? $BASIC["SITENAME"]: "Nexus")."'> ".$lang_settings['text_site_name_note'], 1);
tr($lang_settings['row_base_url'],"<input type='text' style=\"width: 300px\" name=BASEURL value='".($BASIC["BASEURL"] ? $BASIC["BASEURL"] : $_SERVER["HTTP_HOST"])."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"] . $lang_settings['text_base_url_note'], 1);
tr($lang_settings['row_announce_url'],"<input type='text' style=\"width: 300px\" name=announce_url value='".($BASIC["announce_url"] ? $BASIC["announce_url"] : $_SERVER["HTTP_HOST"]."/announce.php")."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"]."/announce.php", 1);
tr($lang_settings['row_mysql_host'],"<input type='text' style=\"width: 300px\" name=mysql_host value='".($BASIC["mysql_host"] ? $BASIC["mysql_host"] : "localhost")."'> ".$lang_settings['text_mysql_host_note'], 1);
tr($lang_settings['row_mysql_user'],"<input type='text' style=\"width: 300px\" name=mysql_user value='".($BASIC["mysql_user"] ? $BASIC["mysql_user"] : "root")."'> ".$lang_settings['text_mysql_user_note'], 1);
tr($lang_settings['row_mysql_password'],"<input type='password' style=\"width: 300px\" name=mysql_pass value=''> ".$lang_settings['text_mysql_password_note'], 1);
tr($lang_settings['row_mysql_database_name'],"<input type='text' style=\"width: 300px\" name=mysql_db value='".($BASIC["mysql_db"] ? $BASIC["mysql_db"] : "nexus")."'> ".$lang_settings['text_mysql_database_name_note'], 1);
tr($lang_settings['row_mysql_database_port'],"<input type='text' style=\"width: 300px\" name=mysql_db value='".($BASIC["mysql_port"] ? $BASIC["mysql_port"] : "3306")."'> ".$lang_settings['text_mysql_database_port_note'], 1);
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("</form>");
}
elseif ($action == 'attachmentsettings') // basic settings
{
stdhead($lang_settings['head_attachment_settings']);
print ($notice);
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_attachment'>");
yesorno($lang_settings['row_enable_attachment'], 'enableattach', $ATTACHMENT["enableattach"], $lang_settings['text_enable_attachment_note']);
tr($lang_settings['row_attachment_authority'], $lang_settings['text_attachment_authority_note_one']."<ul><li>".classlist('classone', UC_STAFFLEADER, $ATTACHMENT['classone']) . $lang_settings['text_can_upload_at_most'] . "<input type='text' style=\"width: 50px\" name=\"countone\" value='".($ATTACHMENT['countone'] ? $ATTACHMENT['countone']: '')."'> ".$lang_settings['text_file_size_below']."<input type='text' style=\"width: 50px\" name=\"sizeone\" value='".($ATTACHMENT['sizeone'] ? $ATTACHMENT['sizeone']: '')."'>".$lang_settings['text_with_extension_name']."<input type='text' style=\"width: 200px\" name=\"extone\" value='".($ATTACHMENT['extone'] ? $ATTACHMENT['extone']: '')."'>".$lang_settings['text_authority_default_one_one'].get_user_class_name(UC_USER,false,true,true).$lang_settings['text_authority_default_one_two']."</li><li>".classlist('classtwo', UC_STAFFLEADER, $ATTACHMENT['classtwo']) . $lang_settings['text_can_upload_at_most'] . "<input type='text' style=\"width: 50px\" name=\"counttwo\" value='".($ATTACHMENT['counttwo'] ? $ATTACHMENT['counttwo']: '')."'> ".$lang_settings['text_file_size_below']."<input type='text' style=\"width: 50px\" name=\"sizetwo\" value='".($ATTACHMENT['sizetwo'] ? $ATTACHMENT['sizetwo']: '')."'>".$lang_settings['text_with_extension_name']."<input type='text' style=\"width: 200px\" name=\"exttwo\" value='".($ATTACHMENT['exttwo'] ? $ATTACHMENT['exttwo']: '')."'>".$lang_settings['text_authority_default_two_one'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_authority_default_two_two']."</li><li>".classlist('classthree', UC_STAFFLEADER, $ATTACHMENT['classthree']) . $lang_settings['text_can_upload_at_most'] . "<input type='text' style=\"width: 50px\" name=\"countthree\" value='".($ATTACHMENT['countthree'] ? $ATTACHMENT['countthree']: '')."'> ".$lang_settings['text_file_size_below']."<input type='text' style=\"width: 50px\" name=\"sizethree\" value='".($ATTACHMENT['sizethree'] ? $ATTACHMENT['sizethree']: '')."'>".$lang_settings['text_with_extension_name']."<input type='text' style=\"width: 200px\" name=\"extthree\" value='".($ATTACHMENT['extthree'] ? $ATTACHMENT['extthree']: '')."'>".$lang_settings['text_authority_default_three_one'].get_user_class_name(UC_INSANE_USER,false,true,true).$lang_settings['text_authority_default_three_two']."</li><li>".classlist('classfour', UC_STAFFLEADER, $ATTACHMENT['classfour']) . $lang_settings['text_can_upload_at_most'] . "<input type='text' style=\"width: 50px\" name=\"countfour\" value='".($ATTACHMENT['countfour'] ? $ATTACHMENT['countfour']: '')."'> ".$lang_settings['text_file_size_below']."<input type='text' style=\"width: 50px\" name=\"sizefour\" value='".($ATTACHMENT['sizefour'] ? $ATTACHMENT['sizefour']: '')."'>".$lang_settings['text_with_extension_name']."<input type='text' style=\"width: 200px\" name=\"extfour\" value='".($ATTACHMENT['extfour'] ? $ATTACHMENT['extfour']: '')."'>".$lang_settings['text_authority_default_four_one'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_authority_default_four_two']."</li></ul>".$lang_settings['text_attachment_authority_note_two'], 1);
tr($lang_settings['row_save_directory'],"<input type='text' style=\"width: 300px\" name=\"savedirectory\" value='".($ATTACHMENT['savedirectory'] ? $ATTACHMENT['savedirectory']: "./attachments")."'> ".$lang_settings['text_save_directory_note'], 1);
tr($lang_settings['row_http_directory'],"<input type='text' style=\"width: 300px\" name=\"httpdirectory\" value='".($ATTACHMENT['httpdirectory'] ? $ATTACHMENT['httpdirectory']: "attachments")."'> ".$lang_settings['text_http_directory_note'], 1);
tr($lang_settings['row_save_directory_type'],"<input type='radio' name='savedirectorytype' value='onedir'".($ATTACHMENT['savedirectorytype'] == "onedir" ? " checked=\"checked\"" : "").">".$lang_settings['text_one_directory']."<br /><input type='radio' name='savedirectorytype' value='monthdir'".($ATTACHMENT['savedirectorytype'] == "monthdir" ? " checked=\"checked\"" : "").">". $lang_settings['text_directories_by_monthes'] . "<br /><input type='radio' name='savedirectorytype' value='daydir'".($ATTACHMENT['savedirectorytype'] == "daydir" ? " checked=\"checked\"" : "").">".$lang_settings['text_directories_by_days'] . "<br />" . $lang_settings['text_save_directory_type_note'], 1);
tr($lang_settings['row_image_thumbnails'],"<input type='radio' name='thumbnailtype' value='no' ".($ATTACHMENT["thumbnailtype"] == 'no' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_no_thumbnail']."<br><input type='radio' name='thumbnailtype' value='createthumb' ".($ATTACHMENT["thumbnailtype"] == 'createthumb' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_create_thumbnail']."<br><input type='radio' name='thumbnailtype' value='resizebigimg' ".($ATTACHMENT["thumbnailtype"] == 'resizebigimg' ? " checked=\"checked\"" : "")."> ". $lang_settings['text_resize_big_image']."<br>" . $lang_settings['text_image_thumbnail_note'], 1);
tr($lang_settings['row_thumbnail_quality'],"<input type='text' style=\"width: 100px\" name=\"thumbquality\" value='".($ATTACHMENT['thumbquality'] ? $ATTACHMENT['thumbquality']: '80')."'> ".$lang_settings['text_thumbnail_quality_note'], 1);
tr($lang_settings['row_thumbnail_size'],"<input type='text' style=\"width: 100px\" name=\"thumbwidth\" value='".($ATTACHMENT['thumbwidth'] ? $ATTACHMENT['thumbwidth']: '500')."'> * <input type='text' style=\"width: 100px\" name=\"thumbheight\" value='".($ATTACHMENT['thumbheight'] ? $ATTACHMENT['thumbheight']: '500')."'> ".$lang_settings['text_thumbnail_size_note'], 1);
tr($lang_settings['row_alternative_thumbnail_size'],"<input type='text' style=\"width: 100px\" name=\"altthumbwidth\" value='".($ATTACHMENT['altthumbwidth'] ? $ATTACHMENT['altthumbwidth']: '180')."'> * <input type='text' style=\"width: 100px\" name=\"altthumbheight\" value='".($ATTACHMENT['altthumbheight'] ? $ATTACHMENT['altthumbheight']: '135')."'> ".$lang_settings['text_alternative_thumbnail_size_note'], 1);
tr($lang_settings['row_watermark'], "<input type='radio' name='watermarkpos' value='no' ".($ATTACHMENT["watermarkpos"] == 'no' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_no_watermark']."<br><input type='radio' name='watermarkpos' value='1' ".($ATTACHMENT["watermarkpos"] == '1' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_left_top']."<input type='radio' name='watermarkpos' value='2' ".($ATTACHMENT["watermarkpos"] == '2' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_top']."<input type='radio' name='watermarkpos' value='3' ".($ATTACHMENT["watermarkpos"] == '3' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_right_top']."<br><input type='radio' name='watermarkpos' value='4' ".($ATTACHMENT["watermarkpos"] == '4' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_left']."<input type='radio' name='watermarkpos' value='5' ".($ATTACHMENT["watermarkpos"] == '5' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_center']."<input type='radio' name='watermarkpos' value='6' ".($ATTACHMENT["watermarkpos"] == '6' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_right']."<br><input type='radio' name='watermarkpos' value='7' ".($ATTACHMENT["watermarkpos"] == '7' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_left_bottom']."<input type='radio' name='watermarkpos' value='8' ".($ATTACHMENT["watermarkpos"] == '8' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_bottom']."<input type='radio' name='watermarkpos' value='9' ".($ATTACHMENT["watermarkpos"] == '9' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_right_bottom']."<br><input type='radio' name='watermarkpos' value='random' ".($ATTACHMENT["watermarkpos"] == 'random' ? " checked=\"checked\"" : "")."> ".$lang_settings['text_random_position']."<br>".$lang_settings['text_watermark_note'], 1);
tr($lang_settings['row_image_size_for_watermark'],"<input type='text' style=\"width: 100px\" name=\"watermarkwidth\" value='".($ATTACHMENT['watermarkwidth'] ? $ATTACHMENT['watermarkwidth']: '300')."'> * <input type='text' style=\"width: 100px\" name=\"watermarkheight\" value='".($ATTACHMENT['watermarkheight'] ? $ATTACHMENT['watermarkheight']: '300')."'> ".$lang_settings['text_watermark_size_note'], 1);
//yesorno($lang_settings['row_add_watermark_to_thumbnail'], 'wmthumb', $ATTACHMENT["wmthumb"], $lang_settings['text_watermark_to_thumbnail_note']);
tr($lang_settings['row_jpeg_quality_with_watermark'],"<input type='text' style=\"width: 100px\" name=\"watermarkquality\" value='".($ATTACHMENT['watermarkquality'] ? $ATTACHMENT['watermarkquality']: '85')."'> ".$lang_settings['text_jpeg_watermark_quality_note'], 1);
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("</form>");
}
elseif ($action == 'advertisementsettings')
{
stdhead($lang_settings['head_advertisement_settings']);
print ($notice);
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_advertisement'>");
yesorno($lang_settings['row_enable_advertisement'], 'enablead', $ADVERTISEMENT['enablead'], $lang_settings['text_enable_advertisement_note']);
tr($lang_settings['row_no_advertisement'], "<input type='checkbox' name='enablenoad' value='yes'".($ADVERTISEMENT['enablenoad'] == 'yes' ? " checked='checked'" : "")." />".classlist('noad', UC_STAFFLEADER, $ADVERTISEMENT['noad']).$lang_settings['text_can_choose_no_advertisement'].get_user_class_name(UC_UPLOADER,false,true,true), 1);
tr($lang_settings['row_bonus_no_advertisement'], "<input type='checkbox' name='enablebonusnoad' value='yes'".($ADVERTISEMENT['enablebonusnoad'] == 'yes' ? " checked='checked'" : "")." />".classlist('bonusnoad', UC_STAFFLEADER, $ADVERTISEMENT['bonusnoad']).$lang_settings['text_no_advertisement_with_bonus'].get_user_class_name(UC_POWER_USER,false,true,true), 1);
tr($lang_settings['row_no_advertisement_bonus_price'], $lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name='bonusnoadpoint' value='".(isset($ADVERTISEMENT["bonusnoadpoint"]) ? $ADVERTISEMENT["bonusnoadpoint"] : 10000 )."'>".$lang_settings['text_bonus_points_to_buy']."<input type='text' style=\"width: 50px\" name='bonusnoadtime' value='".(isset($ADVERTISEMENT["bonusnoadtime"]) ? $ADVERTISEMENT["bonusnoadtime"] : 15 )."'>".$lang_settings['text_days_without_advertisements'], 1);
tr($lang_settings['row_click_advertisement_bonus'], $lang_settings['text_user_would_get']."<input type='text' style=\"width: 50px\" name='adclickbonus' value='".(isset($ADVERTISEMENT["adclickbonus"]) ? $ADVERTISEMENT["adclickbonus"] : 0 )."'>".$lang_settings['text_points_clicking_on_advertisements'], 1);
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("</form>");
}
elseif ($action == 'codesettings') // code settings
{
stdhead($lang_settings['head_code_settings']);
print ($notice);
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_code'>");
tr($lang_settings['row_main_version'],"<input type='text' style=\"width: 300px\" name=mainversion value='".($CODE["mainversion"] ? $CODE["mainversion"] : PROJECTNAME." PHP")."'> ".$lang_settings['text_main_version_note'], 1);
tr($lang_settings['row_sub_version'],"<input type='text' style=\"width: 300px\" name=subversion value='".($CODE["subversion"] ? $CODE["subversion"] : "1.0")."'> ".$lang_settings['text_sub_version_note'], 1);
tr($lang_settings['row_release_date'],"<input type='text' style=\"width: 300px\" name=releasedate value='".($CODE["releasedate"] ? $CODE["releasedate"] : "2008-12-10")."'> ".$lang_settings['text_release_date_note'], 1);
tr($lang_settings['row_web_site'],"<input type='text' style=\"width: 300px\" name=website value='".($CODE["website"] ? $CODE["website"] : "")."'> ".($lang_settings['text_web_site_note_one'] ?? '').PROJECTNAME.$lang_settings['text_web_site_note_two'], 1);
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("</form>");
}
elseif ($action == 'bonussettings'){
stdhead($lang_settings['head_bonus_settings']);
print ($notice);
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_bonus'>");
print("<tr><td colspan=2 align=center><b>".$lang_settings['text_bonus_by_seeding']."</b></td></tr>");
tr($lang_settings['row_donor_gets_double'], $lang_settings['text_donor_gets']."<input type='text' style=\"width: 50px\" name=donortimes value='".(isset($BONUS["donortimes"]) ? $BONUS["donortimes"] : 2 )."'>".$lang_settings['text_times_as_many'],1);
tr($lang_settings['row_basic_seeding_bonus'], $lang_settings['text_user_would_get']."<input type='text' style=\"width: 50px\" name=perseeding value='".(isset($BONUS["perseeding"]) ? $BONUS["perseeding"] : 1 )."'>".$lang_settings['text_bonus_points']."<input type='text' style=\"width: 50px\" name=maxseeding value='".(isset($BONUS["maxseeding"]) ? $BONUS["maxseeding"] : 7 )."'>".$lang_settings['text_torrents_default'], 1);
tr($lang_settings['row_seeding_formula'], $lang_settings['text_bonus_formula_one']."<br />&nbsp;&nbsp;&nbsp;&nbsp;<img src=pic/bonusformulaa.png alt=\"A = sigma( ( 1 - 10 ^ ( - Ti / T0 ) ) * Si * ( 1 + sqrt( 2 ) * 10 ^ ( - ( Ni - 1 ) / ( N0 - 1 ) ) )\" title=\"A = sigma( ( 1 - 10 ^ ( - Ti / T0 ) ) * Si * ( 1 + sqrt( 2 ) * 10 ^ ( - ( Ni - 1 ) / ( N0 - 1 ) ) )\"><br />&nbsp;&nbsp;&nbsp;&nbsp;<img src=pic/bonusformulab.png alt=\"B = B0 * 2 / pi * arctan( A / L )\" title=\"B = B0 * 2 / pi * arctan( A / L )\"><br />".$lang_settings['text_where']."<ul><li>".$lang_settings['text_bonus_formula_two']."</li><li>".$lang_settings['text_bonus_formula_three']."<input type='text' style=\"width: 50px\" name=tzero value='".(isset($BONUS["tzero"]) ? $BONUS["tzero"] : 4 )."'>".$lang_settings['text_bonus_formula_four']."</li><li>".$lang_settings['text_bonus_formula_five']."</li><li>".$lang_settings['text_bonus_formula_six']."<input type='text' style=\"width: 50px\" name=nzero value='".(isset($BONUS["nzero"]) ? $BONUS["nzero"] : 7 )."'>".$lang_settings['text_bonus_formula_seven']."</li><li>".$lang_settings['text_bonus_formula_eight']."</li><li>".$lang_settings['text_bonus_formula_nine']."<input type='text' style=\"width: 50px\" name=bzero value='".(isset($BONUS["bzero"]) ? $BONUS["bzero"] : 100 )."'>".$lang_settings['text_bonus_formula_ten']."</li><li>".$lang_settings['text_bonus_formula_eleven']."<input type='text' style=\"width: 50px\" name=l value='".(isset($BONUS["l"]) ? $BONUS["l"] : 300 )."'>".$lang_settings['text_bonus_formula_twelve']."</li></ul>\n", 1);
print("<tr><td colspan=2 align=center><b>".$lang_settings['text_misc_ways_get_bonus']."</b></td></tr>");
tr($lang_settings['row_uploading_torrent'],$lang_settings['text_user_would_get']."<input type='text' style=\"width: 50px\" name=uploadtorrent value='".(isset($BONUS["uploadtorrent"]) ? $BONUS["uploadtorrent"] : 15 )."'>".$lang_settings['text_uploading_torrent_note'], 1);
tr($lang_settings['row_uploading_subtitle'],$lang_settings['text_user_would_get']."<input type='text' style=\"width: 50px\" name=uploadsubtitle value='".(isset($BONUS["uploadsubtitle"]) ? $BONUS["uploadsubtitle"] : 5 )."'>".$lang_settings['text_uploading_subtitle_note'], 1);
tr($lang_settings['row_starting_topic'],$lang_settings['text_user_would_get']."<input type='text' style=\"width: 50px\" name=starttopic value='".(isset($BONUS["starttopic"]) ? $BONUS["starttopic"] : 2 )."'>".$lang_settings['text_starting_topic_note'], 1);
tr($lang_settings['row_making_post'],$lang_settings['text_user_would_get']."<input type='text' style=\"width: 50px\" name=makepost value='".(isset($BONUS["makepost"]) ? $BONUS["makepost"] : 1 )."'>".$lang_settings['text_making_post_note'], 1);
tr($lang_settings['row_adding_comment'],$lang_settings['text_user_would_get']."<input type='text' style=\"width: 50px\" name=addcomment value='".(isset($BONUS["addcomment"]) ? $BONUS["addcomment"] : 1 )."'>".$lang_settings['text_adding_comment_note'], 1);
tr($lang_settings['row_voting_on_poll'],$lang_settings['text_user_would_get']."<input type='text' style=\"width: 50px\" name=pollvote value='".(isset($BONUS["pollvote"]) ? $BONUS["pollvote"] : 1 )."'>".$lang_settings['text_voting_on_poll_note'], 1);
tr($lang_settings['row_voting_on_offer'],$lang_settings['text_user_would_get']."<input type='text' style=\"width: 50px\" name=offervote value='".(isset($BONUS["offervote"]) ? $BONUS["offervote"] : 1 )."'>".$lang_settings['text_voting_on_offer_note'], 1);
tr($lang_settings['row_voting_on_funbox'],$lang_settings['text_user_would_get']."<input type='text' style=\"width: 50px\" name=funboxvote value='".(isset($BONUS["funboxvote"]) ? $BONUS["funboxvote"] : 1 )."'>".$lang_settings['text_voting_on_funbox_note'], 1);
tr($lang_settings['row_saying_thanks'], $lang_settings['text_giver_and_receiver_get']."<input type='text' style=\"width: 50px\" name=saythanks value='".(isset($BONUS["saythanks"]) ? $BONUS["saythanks"] : 0.5 )."'>".$lang_settings['text_saying_thanks_and']."<input type='text' style=\"width: 50px\" name=receivethanks value='".(isset($BONUS["receivethanks"]) ? $BONUS["receivethanks"] : 0 )."'>".$lang_settings['text_saying_thanks_default'], 1);
tr($lang_settings['row_funbox_stuff_reward'],$lang_settings['text_user_would_get']."<input type='text' style=\"width: 50px\" name=funboxreward value='".(isset($BONUS["funboxreward"]) ? $BONUS["funboxreward"] : 5 )."'>".$lang_settings['text_funbox_stuff_reward_note'], 1);
tr($lang_settings['row_promotion_link_click'],$lang_settings['text_user_would_get']."<input type='text' style=\"width: 50px\" name=prolinkpoint value='".(isset($BONUS["prolinkpoint"]) ? $BONUS["prolinkpoint"] : 0 )."'>".$lang_settings['text_promotion_link_note_one']."<input type='text' style=\"width: 50px\" name=prolinktime value='".(isset($BONUS["prolinktime"]) ? $BONUS["prolinktime"] : 600 )."'>".$lang_settings['text_promotion_link_note_two'], 1);
print("<tr><td colspan=2 align=center><b>".$lang_settings['text_things_cost_bonus']."</b></td></tr>");
tr($lang_settings['row_one_gb_credit'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=onegbupload value='".(isset($BONUS["onegbupload"]) ? $BONUS["onegbupload"] : 300 )."'>".$lang_settings['text_one_gb_credit_note'], 1);
tr($lang_settings['row_five_gb_credit'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=fivegbupload value='".(isset($BONUS["fivegbupload"]) ? $BONUS["fivegbupload"] : 800 )."'>".$lang_settings['text_five_gb_credit_note'], 1);
tr($lang_settings['row_ten_gb_credit'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=tengbupload value='".(isset($BONUS["tengbupload"]) ? $BONUS["tengbupload"] : 1200 )."'>".$lang_settings['text_ten_gb_credit_note'], 1);
tr($lang_settings['row_ratio_limit'],$lang_settings['text_user_with_ratio']."<input type='text' style=\"width: 50px\" name=ratiolimit value='".(isset($BONUS["ratiolimit"]) ? $BONUS["ratiolimit"] : 6 )."'>".$lang_settings['text_uploaded_amount_above']."<input type='text' style=\"width: 50px\" name=dlamountlimit value='".(isset($BONUS["dlamountlimit"]) ? $BONUS["dlamountlimit"] : 50 )."'>".$lang_settings['text_ratio_limit_default'], 1);
tr($lang_settings['row_buy_an_invite'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=oneinvite value='".(isset($BONUS["oneinvite"]) ? $BONUS["oneinvite"] : 1000 )."'>".$lang_settings['text_buy_an_invite_note'], 1);
tr($lang_settings['row_custom_title'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=customtitle value='".(isset($BONUS["customtitle"]) ? $BONUS["customtitle"] : 5000 )."'>".$lang_settings['text_custom_title_note'], 1);
tr($lang_settings['row_vip_status'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=vipstatus value='".(isset($BONUS["vipstatus"]) ? $BONUS["vipstatus"] : 8000 )."'>".$lang_settings['text_vip_status_note'], 1);
yesorno($lang_settings['row_allow_giving_bonus_gift'], 'bonusgift', $BONUS["bonusgift"], $lang_settings['text_giving_bonus_gift_note']);
tr($lang_settings['row_bonus_gift_tax'], $lang_settings['text_system_charges']."<input type='text' style=\"width: 50px\" name='basictax' value='".(isset($BONUS["basictax"]) ? $BONUS["basictax"] : 5 )."'>".$lang_settings['text_bonus_points_plus']."<input type='text' style=\"width: 50px\" name='taxpercentage' value='".(isset($BONUS["taxpercentage"]) ? $BONUS["taxpercentage"] : 10 )."'>".$lang_settings['text_bonus_gift_tax_note'], 1);
tr($lang_settings['row_save_settings'], "<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("</form>");
}
elseif ($action == 'accountsettings'){
stdhead($lang_settings['head_account_settings']);
print ($notice);
$maxclass = UC_VIP;
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_account'>");
print("<tr><td colspan=2 align=center><b>".$lang_settings['text_delete_inactive_accounts']."</b></td></tr>");
tr($lang_settings['row_never_delete'],classlist('neverdelete',$maxclass,$ACCOUNT['neverdelete']).$lang_settings['text_never_delete'].get_user_class_name(UC_VETERAN_USER,false,true,true), 1);
tr($lang_settings['row_never_delete_if_packed'],classlist('neverdeletepacked',$maxclass,$ACCOUNT['neverdeletepacked']).$lang_settings['text_never_delete_if_packed'].get_user_class_name(UC_ELITE_USER,false,true,true), 1);
tr($lang_settings['row_delete_packed'],$lang_settings['text_delete_packed_note_one']."<input type='text' style=\"width: 50px\" name=deletepacked value='".(isset($ACCOUNT["deletepacked"]) ? $ACCOUNT["deletepacked"] : 400 )."'>".$lang_settings['text_delete_packed_note_two'], 1);
tr($lang_settings['row_delete_unpacked'],$lang_settings['text_delete_unpacked_note_one']."<input type='text' style=\"width: 50px\" name=deleteunpacked value='".(isset($ACCOUNT["deleteunpacked"]) ? $ACCOUNT["deleteunpacked"] : 150 )."'>".$lang_settings['text_delete_unpacked_note_two'], 1);
tr($lang_settings['row_delete_no_transfer'],$lang_settings['text_delete_transfer_note_one']."<input type='text' style=\"width: 50px\" name=deletenotransfer value='".(isset($ACCOUNT["deletenotransfer"]) ? $ACCOUNT["deletenotransfer"] : 60 )."'>".$lang_settings['text_delete_transfer_note_two']."<input type='text' style=\"width: 50px\" name=deletenotransfertwo value='".(isset($ACCOUNT["deletenotransfertwo"]) ? $ACCOUNT["deletenotransfertwo"] : 0 )."'>".$lang_settings['text_delete_transfer_note_three'], 1);
print("<tr><td colspan=2 align=center><b>".$lang_settings['text_user_promotion_demotion']."</b></td></tr>");
tr($lang_settings['row_ban_peasant_one'].get_user_class_name(UC_PEASANT,false,false,true).$lang_settings['row_ban_peasant_two'],get_user_class_name(UC_PEASANT,false,true,true).$lang_settings['text_ban_peasant_note_one']."<input type='text' style=\"width: 50px\" name=deletepeasant value='".(isset($ACCOUNT["deletepeasant"]) ? $ACCOUNT["deletepeasant"] : 30 )."'>".$lang_settings['text_ban_peasant_note_two'], 1);
tr($lang_settings['row_demoted_to_peasant_one'].get_user_class_name(UC_PEASANT,false,false,true).$lang_settings['row_demoted_to_peasant_two'],$lang_settings['text_demoted_peasant_note_one'].get_user_class_name(UC_PEASANT,false,true,true).$lang_settings['text_demoted_peasant_note_two']."<br /><ul>
<li>".$lang_settings['text_downloaded_amount_larger_than']."<input type='text' style=\"width: 50px\" name=psdlone value='".(isset($ACCOUNT["psdlone"]) ? $ACCOUNT["psdlone"] : 50 )."'>".$lang_settings['text_and_ratio_below']."<input type='text' style=\"width: 50px\" name=psratioone value='".(isset($ACCOUNT["psratioone"]) ? $ACCOUNT["psratioone"] : 0.4 )."'>".$lang_settings['text_demote_peasant_default_one']."</li>
<li>".$lang_settings['text_downloaded_amount_larger_than']."<input type='text' style=\"width: 50px\" name=psdltwo value='".(isset($ACCOUNT["psdltwo"]) ? $ACCOUNT["psdltwo"] : 100 )."'>".$lang_settings['text_and_ratio_below']."<input type='text' style=\"width: 50px\" name=psratiotwo value='".(isset($ACCOUNT["psratiotwo"]) ? $ACCOUNT["psratiotwo"] : 0.5 )."'>".$lang_settings['text_demote_peasant_default_two']."</li>
<li>".$lang_settings['text_downloaded_amount_larger_than']."<input type='text' style=\"width: 50px\" name=psdlthree value='".(isset($ACCOUNT["psdlthree"]) ? $ACCOUNT["psdlthree"] : 200 )."'>".$lang_settings['text_and_ratio_below']."<input type='text' style=\"width: 50px\" name=psratiothree value='".(isset($ACCOUNT["psratiothree"]) ? $ACCOUNT["psratiothree"] : 0.6 )."'>".$lang_settings['text_demote_peasant_default_three']."</li>
<li>".$lang_settings['text_downloaded_amount_larger_than']."<input type='text' style=\"width: 50px\" name=psdlfour value='".(isset($ACCOUNT["psdlfour"]) ? $ACCOUNT["psdlfour"] : 400 )."'>".$lang_settings['text_and_ratio_below']."<input type='text' style=\"width: 50px\" name=psratiofour value='".(isset($ACCOUNT["psratiofour"]) ? $ACCOUNT["psratiofour"] : 0.7 )."'>".$lang_settings['text_demote_peasant_default_four']."</li>
<li>".$lang_settings['text_downloaded_amount_larger_than']."<input type='text' style=\"width: 50px\" name=psdlfive value='".(isset($ACCOUNT["psdlfive"]) ? $ACCOUNT["psdlfive"] : 800 )."'>".$lang_settings['text_and_ratio_below']."<input type='text' style=\"width: 50px\" name=psratiofive value='".(isset($ACCOUNT["psratiofive"]) ? $ACCOUNT["psratiofive"] : 0.8 )."'>".$lang_settings['text_demote_peasant_default_five']."</li>
</ul><br />".$lang_settings['text_demote_peasant_note'], 1);
function promotion_criteria($class, $input, $time, $dl, $prratio, $deratio, $defaultInvites=0){
global $lang_settings;
global $ACCOUNT;
$inputtime = $input."time";
$inputdl = $input."dl";
$inputprratio = $input."prratio";
$inputderatio = $input."deratio";
if (!isset($class))
return;
tr($lang_settings['row_promote_to_one'].get_user_class_name($class,false,false,true).$lang_settings['row_promote_to_two'], $lang_settings['text_member_longer_than']."<input type='text' style=\"width: 50px\" name='".$inputtime."' value='".(isset($ACCOUNT[$inputtime]) ? $ACCOUNT[$inputtime] : $time )."'>".$lang_settings['text_downloaded_more_than']."<input type='text' style=\"width: 50px\" name='".$inputdl."' value='".(isset($ACCOUNT[$inputdl]) ? $ACCOUNT[$inputdl] : $dl )."'>".$lang_settings['text_with_ratio_above']."<input type='text' style=\"width: 50px\" name='".$inputprratio."' value='".(isset($ACCOUNT[$inputprratio]) ? $ACCOUNT[$inputprratio] : $prratio )."'>".$lang_settings['text_be_promoted_to'].get_user_class_name($class,false,true,true).$lang_settings['text_promote_to_default_one']."'".$time."', '".$dl."', '".$prratio."'.<br />".$lang_settings['text_demote_with_ratio_below']."<input type='text' style=\"width: 50px\" name='".$inputderatio."' value='".(isset($ACCOUNT[$inputderatio]) ? $ACCOUNT[$inputderatio] : $deratio )."'>".$lang_settings['text_promote_to_default_two']."'".$deratio."'.<br />".$lang_settings['text_users_get']."<input type='text' style=\"width: 50px\" name='getInvitesByPromotion[".$class."]' value='".(isset($ACCOUNT['getInvitesByPromotion'][$class]) ? $ACCOUNT['getInvitesByPromotion'][$class] : $defaultInvites )."'>".$lang_settings['text_invitations_default']."'".$defaultInvites."'.", 1);
}
promotion_criteria(UC_POWER_USER, "pu", 4, 50, 1.05, 0.95, 1);
promotion_criteria(UC_ELITE_USER, "eu", 8, 120, 1.55, 1.45, 0);
promotion_criteria(UC_CRAZY_USER, "cu", 15, 300, 2.05, 1.95, 2);
promotion_criteria(UC_INSANE_USER, "iu", 25, 500, 2.55, 2.45, 0);
promotion_criteria(UC_VETERAN_USER, "vu", 40, 750, 3.05, 2.95, 3);
promotion_criteria(UC_EXTREME_USER, "exu", 60, 1024, 3.55, 3.45, 0);
promotion_criteria(UC_ULTIMATE_USER, "uu", 80, 1536, 4.05, 3.95, 5);
promotion_criteria(UC_NEXUS_MASTER, "nm", 100, 3072, 4.55, 4.45, 10);
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("</form>");
}
elseif ($action == 'torrentsettings')
{
stdhead($lang_settings['head_torrent_settings']);
print ($notice);
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_torrent'>");
yesorno($lang_settings['row_promotion_rules'], 'prorules', $TORRENT["prorules"], $lang_settings['text_promotion_rules_note']);
tr($lang_settings['row_random_promotion'], $lang_settings['text_random_promotion_note_one']."<ul><li><input type='text' style=\"width: 50px\" name=randomhalfleech value='".(isset($TORRENT["randomhalfleech"]) ? $TORRENT["randomhalfleech"] : 5 )."'>".$lang_settings['text_halfleech_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomfree value='".(isset($TORRENT["randomfree"]) ? $TORRENT["randomfree"] : 2 )."'>".$lang_settings['text_free_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwoup value='".(isset($TORRENT["randomtwoup"]) ? $TORRENT["randomtwoup"] : 2 )."'>".$lang_settings['text_twoup_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwoupfree value='".(isset($TORRENT["randomtwoupfree"]) ? $TORRENT["randomtwoupfree"] : 1 )."'>".$lang_settings['text_freetwoup_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwouphalfdown value='".(isset($TORRENT["randomtwouphalfdown"]) ? $TORRENT["randomtwouphalfdown"] : 0 )."'>".$lang_settings['text_twouphalfleech_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomthirtypercentdown value='".(isset($TORRENT["randomthirtypercentdown"]) ? $TORRENT["randomthirtypercentdown"] : 0 )."'>".$lang_settings['text_thirtypercentleech_chance_becoming']."</li></ul>".$lang_settings['text_random_promotion_note_two'], 1);
tr($lang_settings['row_large_torrent_promotion'], $lang_settings['text_torrent_larger_than']."<input type='text' style=\"width: 50px\" name=largesize value='".(isset($TORRENT["largesize"]) ? $TORRENT["largesize"] : 20 )."'>".$lang_settings['text_gb_promoted_to']."<select name=largepro>".promotion_selection((isset($TORRENT['largepro']) ? $TORRENT['largepro'] : 2), 1)."</select>".$lang_settings['text_by_system_upon_uploading']."<br />".$lang_settings['text_large_torrent_promotion_note'], 1);
tr($lang_settings['row_promotion_timeout'], $lang_settings['text_promotion_timeout_note_one']."<ul>
<li>".$lang_settings['text_halfleech_will_become']."<select name=halfleechbecome>".promotion_selection((isset($TORRENT['halfleechbecome']) ? $TORRENT['halfleechbecome'] : 1), 5)."</select>".$lang_settings['text_after']."<input type='text' style=\"width: 50px\" name=expirehalfleech value='".(isset($TORRENT["expirehalfleech"]) ? $TORRENT["expirehalfleech"] : 150 )."'>".$lang_settings['text_halfleech_timeout_default']."</li>
<li>".$lang_settings['text_free_will_become']."<select name=freebecome>".promotion_selection((isset($TORRENT['freebecome']) ? $TORRENT['freebecome'] : 1), 2)."</select>".$lang_settings['text_after']."<input type='text' style=\"width: 50px\" name=expirefree value='".(isset($TORRENT["expirefree"]) ? $TORRENT["expirefree"] : 60 )."'>".$lang_settings['text_free_timeout_default']."</li>
<li>".$lang_settings['text_twoup_will_become']."<select name=twoupbecome>".promotion_selection((isset($TORRENT['twoupbecome']) ? $TORRENT['twoupbecome'] : 1), 3)."</select>".$lang_settings['text_after']."<input type='text' style=\"width: 50px\" name=expiretwoup value='".(isset($TORRENT["expiretwoup"]) ? $TORRENT["expiretwoup"] : 60 )."'>".$lang_settings['text_twoup_timeout_default']."</li>
<li>".$lang_settings['text_freetwoup_will_become']."<select name=twoupfreebecome>".promotion_selection((isset($TORRENT['twoupfreebecome']) ? $TORRENT['twoupfreebecome'] : 1), 4)."</select>".$lang_settings['text_after']."<input type='text' style=\"width: 50px\" name=expiretwoupfree value='".(isset($TORRENT["expiretwoupfree"]) ? $TORRENT["expiretwoupfree"] : 30 )."'>".$lang_settings['text_freetwoup_timeout_default']."</li>
<li>".$lang_settings['text_halfleechtwoup_will_become']."<select name=twouphalfleechbecome>".promotion_selection((isset($TORRENT['twouphalfleechbecome']) ? $TORRENT['twouphalfleechbecome'] : 1), 6)."</select>".$lang_settings['text_after']."<input type='text' style=\"width: 50px\" name=expiretwouphalfleech value='".(isset($TORRENT["expiretwouphalfleech"]) ? $TORRENT["expiretwouphalfleech"] : 30 )."'>".$lang_settings['text_halfleechtwoup_timeout_default']."</li>
<li>".$lang_settings['text_thirtypercentleech_will_become']."<select name=thirtypercentleechbecome>".promotion_selection((isset($TORRENT['thirtypercentleechbecome']) ? $TORRENT['thirtypercentleechbecome'] : 1), 7)."</select>".$lang_settings['text_after']."<input type='text' style=\"width: 50px\" name=expirethirtypercentleech value='".(isset($TORRENT["expirethirtypercentleech"]) ? $TORRENT["expirethirtypercentleech"] : 30 )."'>".$lang_settings['text_thirtypercentleech_timeout_default']."</li>
<li>".$lang_settings['text_normal_will_become']."<select name=normalbecome>".promotion_selection((isset($TORRENT['normalbecome']) ? $TORRENT['normalbecome'] : 1), 0)."</select>".$lang_settings['text_after']."<input type='text' style=\"width: 50px\" name=expirenormal value='".(isset($TORRENT["expirenormal"]) ? $TORRENT["expirenormal"] : 0 )."'>".$lang_settings['text_normal_timeout_default']."</li>
</ul>".$lang_settings['text_promotion_timeout_note_two'], 1);
tr($lang_settings['row_auto_pick_hot'], $lang_settings['text_torrents_uploaded_within']."<input type='text' style=\"width: 50px\" name=hotdays value='".(isset($TORRENT["hotdays"]) ? $TORRENT["hotdays"] : 7 )."'>".$lang_settings['text_days_with_more_than']."<input type='text' style=\"width: 50px\" name=hotseeder value='".(isset($TORRENT["hotseeder"]) ? $TORRENT["hotseeder"] : 10 )."'>".$lang_settings['text_be_picked_as_hot']."<br />".$lang_settings['text_auto_pick_hot_default'], 1);
tr($lang_settings['row_uploader_get_double'], $lang_settings['text_torrent_uploader_gets']."<input type='text' style=\"width: 50px\" name=uploaderdouble value='".(isset($TORRENT["uploaderdouble"]) ? $TORRENT["uploaderdouble"] : 1 )."'>".$lang_settings['text_times_uploading_credit'].$lang_settings['text_uploader_get_double_default'], 1);
tr($lang_settings['row_delete_dead_torrents'], $lang_settings['text_torrents_being_dead_for']."<input type='text' style=\"width: 50px\" name=deldeadtorrent value='".(isset($TORRENT["deldeadtorrent"]) ? $TORRENT["deldeadtorrent"] : 0 )."'>".$lang_settings['text_days_be_deleted']."<br />".$lang_settings['row_delete_dead_torrents_note'], 1);
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("</form>");
}
elseif ($action == 'mainsettings') // main settings
{
stdhead($lang_settings['head_main_settings']);
print ($notice);
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_main'>");
$sh = "gmail.com";
yesorno($lang_settings['row_site_online'], 'site_online', $MAIN['site_online'], $lang_settings['text_site_online_note']);
yesorno($lang_settings['row_enable_invite_system'], 'invitesystem', $MAIN['invitesystem'], $lang_settings['text_invite_system_note']);
tr($lang_settings['row_initial_uploading_amount'],"<input type='text' name=iniupload style=\"width: 100px\" value=$MAIN[iniupload]> ".$lang_settings['text_initial_uploading_amount_note'], 1);
tr($lang_settings['row_initial_invites'],"<input type='text' name=invite_count style=\"width: 50px\" value=$MAIN[invite_count]> ".$lang_settings['text_initial_invites_note'], 1);
tr($lang_settings['row_invite_timeout'],"<input type='text' name=invite_timeout style=\"width: 50px\" value=$MAIN[invite_timeout]> ".$lang_settings['text_invite_timeout_note'], 1);
yesorno($lang_settings['row_enable_registration_system'], 'registration', $MAIN['registration'], $lang_settings['row_allow_registrations']);
tr($lang_settings['row_verification_type'],"<input type='radio' name='verification'" . ($MAIN["verification"] == "email" ? " checked" : " checked") . " value='email'> ".$lang_settings['text_email'] ." <input type='radio' name='verification'" . ($MAIN["verification"] == "admin" ? " checked" : "") . " value='admin'> ".$lang_settings['text_admin']." <input type='radio' name='verification'" . ($MAIN["verification"] == "automatic" ? " checked" : "") . " value='automatic'> ".$lang_settings['text_automatically']."<br />".$lang_settings['text_verification_type_note'], 1);
yesorno($lang_settings['row_enable_wait_system'],'waitsystem', $MAIN['waitsystem'], $lang_settings['text_wait_system_note']);
yesorno($lang_settings['row_enable_max_slots_system'],'maxdlsystem', $MAIN['maxdlsystem'], $lang_settings['text_max_slots_system_note']);
yesorno($lang_settings['row_show_polls'], 'showpolls', $MAIN['showpolls'], $lang_settings['text_show_polls_note']);
yesorno($lang_settings['row_show_stats'],'showstats', $MAIN['showstats'], $lang_settings['text_show_stats_note']);
//yesorno($lang_settings['row_show_last_posts'],'showlastxforumposts', $MAIN['showlastxforumposts'], $lang_settings['text_show_last_posts_note']);
yesorno($lang_settings['row_show_last_torrents'],'showlastxtorrents', $MAIN['showlastxtorrents'], $lang_settings['text_show_last_torrents_note']);
yesorno($lang_settings['row_show_server_load'],'showtrackerload', $MAIN['showtrackerload'], $lang_settings['text_show_server_load_note']);
yesorno($lang_settings['row_show_forum_stats'],'showforumstats', $MAIN['showforumstats'], $lang_settings['text_show_forum_stats_note']);
yesorno($lang_settings['row_show_hot'],'showhotmovies', $MAIN['showhotmovies'], $lang_settings['text_show_hot_note']);
yesorno($lang_settings['row_show_classic'],'showclassicmovies', $MAIN['showclassicmovies'], $lang_settings['text_show_classic_note']);
yesorno($lang_settings['row_enable_imdb_system'],'showimdbinfo', $MAIN['showimdbinfo'], $lang_settings['text_imdb_system_note']);
yesorno($lang_settings['row_enable_nfo'],'enablenfo', $MAIN['enablenfo'], $lang_settings['text_enable_nfo_note']);
yesorno($lang_settings['row_enable_school_system'],'enableschool', $MAIN['enableschool'], $lang_settings['text_school_system_note']);
yesorno($lang_settings['row_restrict_email_domain'],'restrictemail', $MAIN['restrictemail'], $lang_settings['text_restrict_email_domain_note']);
yesorno($lang_settings['row_show_shoutbox'],'showshoutbox', $MAIN['showshoutbox'], $lang_settings['text_show_shoutbox_note']);
yesorno($lang_settings['row_show_funbox'],'showfunbox', $MAIN['showfunbox'], $lang_settings['text_show_funbox_note']);
yesorno($lang_settings['row_enable_offer_section'],'showoffer', $MAIN['showoffer'], $lang_settings['text_offer_section_note']);
yesorno($lang_settings['row_show_donation'],'donation', $MAIN['donation'], $lang_settings['text_show_donation_note']);
if (THISTRACKER == "HDStar")
yesorno($lang_settings['row_show_special_section'],'spsct', $MAIN['spsct'], $lang_settings['text_show_special_section_note']);
yesorno($lang_settings['row_weekend_free_uploading'],'sptime', $MAIN['sptime'], $lang_settings['text_weekend_free_uploading_note']);
yesorno($lang_settings['row_enable_helpbox'],'showhelpbox', $MAIN['showhelpbox'], $lang_settings['text_helpbox_note']);
yesorno($lang_settings['row_enable_bitbucket'],'enablebitbucket', $MAIN['enablebitbucket'], $lang_settings['text_bitbucket_note']);
yesorno($lang_settings['row_enable_small_description'],'smalldescription', $MAIN['smalldescription'], $lang_settings['text_small_description_note']);
if (THISTRACKER == "PTShow")
yesorno($lang_settings['row_ptshow_naming_style'],' altname', $MAIN['altname'], $lang_settings['text_ptshow_naming_style_note']);
yesorno($lang_settings['row_use_external_forum'],'extforum', $MAIN['extforum'], $lang_settings['text_use_external_forum_note']);
tr($lang_settings['row_external_forum_url'],"<input type='text' style=\"width: 300px\" name=extforumurl value='".($MAIN["extforumurl"] ? $MAIN["extforumurl"] : "")."'> ".$lang_settings['text_external_forum_url_note'], 1);
$res = sql_query("SELECT id, name FROM searchbox") or sqlerr(__FILE__, __LINE__);
$catlist = "";
$bcatlist = $scatlist = '';
while($array = mysql_fetch_array($res)){
$bcatlist .= "<input type=radio name=browsecat value='".$array['id']."'".($MAIN["browsecat"] == $array['id'] ? " checked" : "").">".$array['name']."&nbsp;";
$scatlist .= "<input type=radio name=specialcat value='".$array['id']."'".($MAIN["specialcat"] == $array['id'] ? " checked" : "").">".$array['name']."&nbsp;";
}
tr($lang_settings['row_torrents_category_mode'], $bcatlist."<br />".$lang_settings['text_torrents_category_mode_note'], 1);
if (THISTRACKER == "HDStar")
tr($lang_settings['row_special_category_mode'], $scatlist."<br />".$lang_settings['text_special_category_mode_note'], 1);
$res = sql_query("SELECT * FROM language WHERE site_lang=1") or sqlerr(__FILE__, __LINE__);
$langlist = "";
while($array = mysql_fetch_array($res))
$langlist .= "<input type=radio name=defaultlang value='".$array['site_lang_folder']."'".($MAIN["defaultlang"] == $array['site_lang_folder'] ? " checked" : "").">".$array['lang_name']."&nbsp;";
tr($lang_settings['row_default_site_language'], $langlist."<br />".$lang_settings['text_default_site_language_note'], 1);
$res = sql_query("SELECT * FROM stylesheets ORDER BY name") or sqlerr(__FILE__, __LINE__);
$csslist = "<select name=defstylesheet>";
while($array = mysql_fetch_array($res))
$csslist .= "<option value='".$array['id']."'".($MAIN["defstylesheet"] == $array['id'] ? " selected" : "").">".$array['name']."</option>";
$csslist .= "</select>";
tr($lang_settings['row_default_stylesheet'], $csslist."<br />".$lang_settings['text_default_stylesheet_note'], 1);
tr($lang_settings['row_site_logo'],"<input type='text' style=\"width: 100px\" name='logo' value='".($MAIN["logo"] ? $MAIN["logo"] : "")."'>".$lang_settings['text_site_logo_note'], 1);
tr($lang_settings['row_max_torrent_size'],"<input type='text' style=\"width: 100px\" name='max_torrent_size' value='".($MAIN["max_torrent_size"] ? $MAIN["max_torrent_size"] : 1048576)."'>".$lang_settings['text_max_torrent_size_note'], 1);
tr($lang_settings['row_announce_interval'], $lang_settings['text_announce_interval_note_one']."<br /><ul><li>".$lang_settings['text_announce_default']."<input type='text' style=\"width: 100px\" name=announce_interval value='".($MAIN["announce_interval"] ? $MAIN["announce_interval"] : 1800)."'> ".$lang_settings['text_announce_default_default']."</li><li>".$lang_settings['text_for_torrents_older_than']."<input type='text' style=\"width: 100px\" name=annintertwoage value='".($MAIN["annintertwoage"] ? $MAIN["annintertwoage"] : 7)."'>".$lang_settings['text_days']."<input type='text' style=\"width: 100px\" name=annintertwo value='".($MAIN["annintertwo"] ? $MAIN["annintertwo"] : 2700)."'> ".$lang_settings['text_announce_two_default']."</li><li>".$lang_settings['text_for_torrents_older_than']."<input type='text' style=\"width: 100px\" name=anninterthreeage value='".($MAIN["anninterthreeage"] ? $MAIN["anninterthreeage"] : 30)."'>".$lang_settings['text_days']."<input type='text' style=\"width: 100px\" name=anninterthree value='".($MAIN["anninterthree"] ? $MAIN["anninterthree"] : 3600)."'> ".$lang_settings['text_announce_three_default']."</li></ul>".$lang_settings['text_announce_interval_note_two'], 1);
tr($lang_settings['row_cleanup_interval'], $lang_settings['text_cleanup_interval_note_one']."<br /><ul><li>".$lang_settings['text_priority_one']."<input type='text' style=\"width: 100px\" name=autoclean_interval_one value='".($MAIN["autoclean_interval_one"] ? $MAIN["autoclean_interval_one"] : 900)."'> ".$lang_settings['text_priority_one_note']."</li><li>".$lang_settings['text_priority_two']."<input type='text' style=\"width: 100px\" name=autoclean_interval_two value='".($MAIN["autoclean_interval_two"] ? $MAIN["autoclean_interval_two"] : 1800)."'> ".$lang_settings['text_priority_two_note']."</li><li>".$lang_settings['text_priority_three']."<input type='text' style=\"width: 100px\" name=autoclean_interval_three value='".($MAIN["autoclean_interval_three"] ? $MAIN["autoclean_interval_three"] : 3600)."'> ".$lang_settings['text_priority_three_note']."</li><li>".$lang_settings['text_priority_four']."<input type='text' style=\"width: 100px\" name=autoclean_interval_four value='".($MAIN["autoclean_interval_four"] ? $MAIN["autoclean_interval_four"] : 43200)."'> ".$lang_settings['text_priority_four_note']."</li><li>".$lang_settings['text_priority_five']."<input type='text' style=\"width: 100px\" name=autoclean_interval_five value='".($MAIN["autoclean_interval_five"] ? $MAIN["autoclean_interval_five"] : 648000)."'> ".$lang_settings['text_priority_five_note']."</li></ul>".$lang_settings['text_cleanup_interval_note_two'], 1);
tr($lang_settings['row_signup_timeout'],"<input type='text' style=\"width: 100px\" name=signup_timeout value='".($MAIN["signup_timeout"] ? $MAIN["signup_timeout"] : 259200)."'> ".$lang_settings['text_signup_timeout_note'], 1);
tr($lang_settings['row_min_offer_votes'],"<input type='text' style=\"width: 100px\" name=minoffervotes value='".($MAIN["minoffervotes"] ? $MAIN["minoffervotes"] : 15)."'> ".$lang_settings['text_min_offer_votes_note'], 1);
tr($lang_settings['row_offer_vote_timeout'],"<input type='text' style=\"width: 100px\" name=offervotetimeout value='".(isset($MAIN["offervotetimeout"]) ? $MAIN["offervotetimeout"] : 259200)."'> ".$lang_settings['text_offer_vote_timeout_note'], 1);
tr($lang_settings['row_offer_upload_timeout'],"<input type='text' style=\"width: 100px\" name=offeruptimeout value='".(isset($MAIN["offeruptimeout"]) ? $MAIN["offeruptimeout"] : 86400)."'> ".$lang_settings['text_offer_upload_timeout_note'], 1);
tr($lang_settings['row_max_subtitle_size'],"<input type='text' style=\"width: 100px\" name=maxsubsize value='".(isset($MAIN["maxsubsize"]) ? $MAIN["maxsubsize"] : 3145728)."'> ". $lang_settings['text_max_subtitle_size_note'], 1);
tr($lang_settings['row_posts_per_page'],"<input type='text' style=\"width: 100px\" name=postsperpage value='".($MAIN["postsperpage"] ? $MAIN["postsperpage"] : 10)."'> ".$lang_settings['text_posts_per_page_note'], 1);
tr($lang_settings['row_topics_per_page'],"<input type='text' style=\"width: 100px\" name=topicsperpage value='".($MAIN["topicsperpage"] ? $MAIN["topicsperpage"] : 20)."'> ".$lang_settings['text_topics_per_page_note'], 1);
tr($lang_settings['row_torrents_per_page'],"<input type='text' style=\"width: 100px\" name=torrentsperpage value='".($MAIN["torrentsperpage"] ? $MAIN["torrentsperpage"] : 50)."'> ".$lang_settings['text_torrents_per_page_note'], 1);
tr($lang_settings['row_number_of_news'],"<input type='text' style=\"width: 100px\" name=maxnewsnum value='".($MAIN["maxnewsnum"] ? $MAIN["maxnewsnum"] : 3)."'> ".$lang_settings['text_number_of_news_note'], 1);
tr($lang_settings['row_torrent_dead_time'],"<input type='text' style=\"width: 100px\" name=max_dead_torrent_time value='".($MAIN["max_dead_torrent_time"] ? $MAIN["max_dead_torrent_time"] : "21600")."'> ".$lang_settings['text_torrent_dead_time_note'], 1);
tr($lang_settings['row_max_users'],"<input type='text' style=\"width: 100px\" name=maxusers value='".($MAIN["maxusers"] ? $MAIN["maxusers"] : "2500" )."'> ".$lang_settings['text_max_users'], 1);
tr($lang_settings['row_site_accountant_userid'],"<input type='text' style=\"width: 200px\" name=\"ACCOUNTANTID\" value='".($MAIN['ACCOUNTANTID'] ? $MAIN['ACCOUNTANTID'] : "")."'> ".$lang_settings['text_site_accountant_userid_note'], 1);
tr($lang_settings['row_alipay_account'],"<input type='text' style=\"width: 200px\" name=\"ALIPAYACCOUNT\" value='".($MAIN['ALIPAYACCOUNT'] ? $MAIN['ALIPAYACCOUNT'] : "")."'> ".$lang_settings['text_alipal_account_note'], 1);
tr($lang_settings['row_paypal_account'],"<input type='text' style=\"width: 200px\" name=PAYPALACCOUNT value='".($MAIN["PAYPALACCOUNT"] ? $MAIN["PAYPALACCOUNT"] : "")."'> ".$lang_settings['text_paypal_account_note'], 1);
tr($lang_settings['row_site_email'],"<input type='text' style=\"width: 200px\" name=SITEEMAIL value='".($MAIN["SITEEMAIL"] ? $MAIN["SITEEMAIL"] : "noreply@".$sh)."'> ".$lang_settings['text_site_email_note'], 1);
tr($lang_settings['row_report_email'],"<input type='text' style=\"width: 200px\" name=reportemail value='".($MAIN["reportemail"] ? $MAIN["reportemail"] : "report@".$sh)."'> ".$lang_settings['text_report_email_note'], 1);
tr($lang_settings['row_site_slogan'],"<input type='text' style=\"width: 300px\" name=SLOGAN value='".($MAIN["SLOGAN"] ? $MAIN["SLOGAN"]: "")."'> ".$lang_settings['text_site_slogan_note'], 1);
tr($lang_settings['row_icp_license'],"<input type='text' style=\"width: 300px\" name=icplicense value='".($MAIN["icplicense"] ? $MAIN["icplicense"]: "")."'> ".$lang_settings['text_icp_license_note'], 1);
tr($lang_settings['row_torrent_directory'], "<input type='text' style=\"width: 100px\" name=torrent_dir value='".($MAIN["torrent_dir"] ? $MAIN["torrent_dir"] : "torrents")."'> ".$lang_settings['text_torrent_directory'], 1);
tr($lang_settings['row_bitbucket_directory'],"<input type='text' style=\"width: 100px\" name=bitbucket value='".($MAIN["bitbucket"] ? $MAIN["bitbucket"] : "bitbucket")."'> ".$lang_settings['text_bitbucket_directory_note'], 1);
tr($lang_settings['row_torrent_name_prefix'], "<input type='text' style=\"width: 100px\" name=torrentnameprefix value='".($MAIN["torrentnameprefix"] ? $MAIN["torrentnameprefix"] : "[Nexus]")."'> ".$lang_settings['text_torrent_name_prefix_note'], 1);
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
print ("</form>");
}
elseif ($action == 'showmenu') // settings main page
{
stdhead($lang_settings['head_website_settings']);
print ($notice);
tr($lang_settings['row_basic_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='basicsettings'><input type='submit' value=\"".$lang_settings['submit_basic_settings']."\"> ".$lang_settings['text_basic_settings_note']."</form>", 1);
tr($lang_settings['row_main_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='mainsettings'><input type='submit' value=\"".$lang_settings['submit_main_settings']."\"> ".$lang_settings['text_main_settings_note']."</form>", 1);
tr($lang_settings['row_smtp_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='smtpsettings'><input type='submit' value=\"".$lang_settings['submit_smtp_settings']."\"> ".$lang_settings['text_smtp_settings_note']."</form>", 1);
tr($lang_settings['row_security_settings'],"<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='securitysettings'><input type='submit' value=\"".$lang_settings['submit_security_settings']."\"> ".$lang_settings['text_security_settings_note']."</form>", 1);
tr($lang_settings['row_authority_settings'],"<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='authoritysettings'><input type='submit' value=\"".$lang_settings['submit_authority_settings']."\"> ".$lang_settings['text_authority_settings_note']."</form>", 1);
tr($lang_settings['row_tweak_settings'],"<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='tweaksettings'><input type='submit' value=\"".$lang_settings['submit_tweak_settings']."\"> ".$lang_settings['text_tweak_settings_note']."</form>", 1);
tr($lang_settings['row_bonus_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='bonussettings'><input type='submit' value=\"".$lang_settings['submit_bonus_settings']."\"> ".$lang_settings['text_bonus_settings_note']."</form>", 1);
tr($lang_settings['row_account_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='accountsettings'><input type='submit' value=\"".$lang_settings['submit_account_settings']."\"> ".$lang_settings['text_account_settings_settings']."</form>", 1);
tr($lang_settings['row_torrents_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='torrentsettings'><input type='submit' value=\"".$lang_settings['submit_torrents_settings']."\"> ".$lang_settings['text_torrents_settings_note']."</form>", 1);
tr($lang_settings['row_attachment_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='attachmentsettings'><input type='submit' value=\"".$lang_settings['submit_attachment_settings']."\"> ".$lang_settings['text_attachment_settings_note']."</form>", 1);
tr($lang_settings['row_advertisement_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='advertisementsettings'><input type='submit' value=\"".$lang_settings['submit_advertisement_settings']."\"> ".$lang_settings['text_advertisement_settings_note']."</form>", 1);
tr($lang_settings['row_code_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='codesettings'><input type='submit' value=\"".$lang_settings['submit_code_settings']."\"> ".$lang_settings['text_code_settings_note']."</form>", 1);
}
elseif ($action == 'i18n')
{
stdhead(__('internationalization'));
searchtable(__('query_internationalization'), 'i18n');
print ($notice);
if (!empty($_GET['action']) && $_GET['action'] == 'i18n' && !empty($_GET['query'])) {
$result = sql_query(sprintf("select * from i18n where name = %s", sqlesc($_GET['query'])));
$i18n = [];
while ($row = mysql_fetch_assoc($result)) {
$i18n[$row['locale']] = $row['translation'];
}
}
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='saveI18n'>");
tr(__('internationalization_name'),'<input type="text" style="width: 300px" name="name" value="' . ($_GET['query'] ?? '') . '">', 1);
$result = sql_query(sprintf("select * from language where site_lang_folder in ('en', 'chs', 'cht')"));
while ($row = mysql_fetch_assoc($result)) {
tr($row['lang_name'],'<input type="text" style="width: 300px" name="translation[' . $row['site_lang_folder'] . ']" value="' . ($i18n[$row['site_lang_folder']] ?? '') . '">' . " {$row['lang_name']} - " . __('internationalization_translation'), 1);
}
tr(__('internationalization_form_save_btn'),'<input type="submit" name="save" value="' . __('internationalization_form_save_btn') .'">', 1);
print ("</form>");
}
elseif ($action == 'saveI18n')
{
stdhead(__('internationalization_form_submit'));
foreach ($_POST['translation'] as $locale => $translation) {
$sql = sprintf(
"insert into i18n (name, locale, translation) values (%s, %s, %s) on duplicate key update translation = values(translation)",
sqlesc($_POST['name']), sqlesc($locale), sqlesc($translation)
);
sql_query($sql);
}
$actiontime = date("F j, Y, g:i a");
write_log("Tracker ATTACHMENT settings updated by $CURUSER[username]. $actiontime",'mod');
go_back();
}
print("</table>");
stdfoot();
+60
View File
@@ -0,0 +1,60 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
$action = $_GET['action'];
$imagehash = $_GET['imagehash'];
if($action == "regimage")
{
$query = "SELECT * FROM regimages WHERE imagehash= ".sqlesc($imagehash);
$sql = sql_query($query);
$regimage = mysql_fetch_array($sql);
$imagestring = $regimage['imagestring'];
$space = $newstring = '';
for($i=0;$i<strlen($imagestring);$i++)
{
$newstring .= $space.$imagestring[$i];
$space = " ";
}
$imagestring = $newstring;
if(function_exists("imagecreatefrompng"))
{
$fontwidth = imageFontWidth(5);
$fontheight = imageFontHeight(5);
$textwidth = $fontwidth*strlen($imagestring);
$textheight = $fontheight;
$randimg = rand(1, 5);
$im = imagecreatefrompng("pic/regimages/reg".$randimg.".png");
$imgheight = 40;
$imgwidth = 150;
$textposh = ($imgwidth-$textwidth)/2;
$textposv = ($imgheight-$textheight)/2;
$dots = $imgheight*$imgwidth/35;
$textcolor = null;
for($i=1;$i<=$dots;$i++)
{
imagesetpixel($im, rand(0, $imgwidth), rand(0, $imgheight), $textcolor);
}
$textcolor = imagecolorallocate($im, 0, 0, 0);
imagestring($im, 5, $textposh, $textposv, $imagestring, $textcolor);
// output the image
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);
exit;
}
else
{
header("Location: pic/clear.gif");
}
}
else
{
die('invalid action');
}
?>
+628
View File
@@ -0,0 +1,628 @@
<?php
require "../include/bittorrent.php";
dbconn(true);
require_once(get_langfile_path());
loggedinorreturn(true);
$userid = $CURUSER["id"];
if ($showextinfo['imdb'] == 'yes')
require_once ("imdb/imdb.class.php");
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if ($showpolls_main == "yes")
{
$choice = $_POST["choice"];
if ($CURUSER && $choice != "" && $choice < 256 && $choice == floor($choice))
{
$res = sql_query("SELECT * FROM polls ORDER BY added DESC LIMIT 1") or sqlerr(__FILE__, __LINE__);
$arr = mysql_fetch_assoc($res) or die($lang_index['std_no_poll']);
$pollid = $arr["id"];
$hasvoted = get_row_count("pollanswers","WHERE pollid=".sqlesc($pollid)." && userid=".sqlesc($CURUSER["id"]));
if ($hasvoted)
stderr($lang_index['std_error'],$lang_index['std_duplicate_votes_denied']);
sql_query("INSERT INTO pollanswers VALUES(0, ".sqlesc($pollid).", ".sqlesc($CURUSER["id"]).", ".sqlesc($choice).")") or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('current_poll_content');
$Cache->delete_value('current_poll_result', true);
if (mysql_affected_rows() != 1)
stderr($lang_index['std_error'], $lang_index['std_vote_not_counted']);
//add karma
KPS("+",$pollvote_bonus,$userid);
header("Location: " . get_protocol_prefix() . "$BASEURL/");
die;
}
else
stderr($lang_index['std_error'], $lang_index['std_option_unselected']);
}
}
stdhead($lang_index['head_home']);
begin_main_frame();
// ------------- start: recent news ------------------//
print("<h2>".$lang_index['text_recent_news'].(get_user_class() >= $newsmanage_class ? " - <font class=\"small\">[<a class=\"altlink\" href=\"news.php\"><b>".$lang_index['text_news_page']."</b></a>]</font>" : "")."</h2>");
$Cache->new_page('recent_news', 86400, true);
if (!$Cache->get_page()){
$res = sql_query("SELECT * FROM news ORDER BY added DESC LIMIT ".(int)$maxnewsnum_main) or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
{
$Cache->add_whole_row();
print("<table width=\"100%\"><tr><td class=\"text\"><div style=\"margin-left: 16pt;\">\n");
$Cache->end_whole_row();
$news_flag = 0;
while($array = mysql_fetch_array($res))
{
$Cache->add_row();
$Cache->add_part();
if ($news_flag < 1) {
print("<a href=\"javascript: klappe_news('a".$array['id']."')\"><img class=\"minus\" src=\"pic/trans.gif\" id=\"pica".$array['id']."\" alt=\"Show/Hide\" title=\"".$lang_index['title_show_or_hide']."\" />&nbsp;" . date("Y.m.d",strtotime($array['added'])) . " - " ."<b>". $array['title'] . "</b></a>");
print("<div id=\"ka".$array['id']."\" style=\"display: block;\"> ".format_comment($array["body"],0)." </div> ");
$news_flag = $news_flag + 1;
}
else
{
print("<a href=\"javascript: klappe_news('a".$array['id']."')\"><br /><img class=\"plus\" src=\"pic/trans.gif\" id=\"pica".$array['id']."\" alt=\"Show/Hide\" title=\"".$lang_index['title_show_or_hide']."\" />&nbsp;" . date("Y.m.d",strtotime($array['added'])) . " - " ."<b>". $array['title'] . "</b></a>");
print("<div id=\"ka".$array['id']."\" style=\"display: none;\"> ".format_comment($array["body"],0)." </div> ");
}
$Cache->end_part();
$Cache->add_part();
print(" &nbsp; [<a class=\"faqlink\" href=\"news.php?action=edit&amp;newsid=" . $array['id'] . "\"><b>".$lang_index['text_e']."</b></a>]");
print(" [<a class=\"faqlink\" href=\"news.php?action=delete&amp;newsid=" . $array['id'] . "\"><b>".$lang_index['text_d']."</b></a>]");
$Cache->end_part();
$Cache->end_row();
}
$Cache->break_loop();
$Cache->add_whole_row();
print("</div></td></tr></table>\n");
$Cache->end_whole_row();
}
$Cache->cache_page();
}
echo $Cache->next_row();
while($Cache->next_row()){
echo $Cache->next_part();
if (get_user_class() >= $newsmanage_class)
echo $Cache->next_part();
}
echo $Cache->next_row();
// ------------- end: recent news ------------------//
// ------------- start: hot and classic movies ------------------//
if ($showextinfo['imdb'] == 'yes' && ($showmovies['hot'] == "yes" || $showmovies['classic'] == "yes"))
{
$type = array('hot', 'classic');
foreach($type as $type_each)
{
if($showmovies[$type_each] == 'yes' && (!isset($CURUSER) || $CURUSER['show' . $type_each] == 'yes'))
{
$Cache->new_page($type_each.'_resources', 900, true);
if (!$Cache->get_page())
{
$Cache->add_whole_row();
$imdbcfg = new imdb_config();
$res = sql_query("SELECT * FROM torrents WHERE picktype = " . sqlesc($type_each) . " AND seeders > 0 AND url != '' ORDER BY id DESC LIMIT 30") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
{
$movies_list = "";
$count = 0;
$allImdb = array();
while($array = mysql_fetch_array($res))
{
$pro_torrent = get_torrent_promotion_append($array[sp_state],'word');
if ($imdb_id = parse_imdb_id($array["url"]))
{
if (array_search($imdb_id, $allImdb) !== false) { //a torrent with the same IMDb url already exists
continue;
}
$allImdb[]=$imdb_id;
$photo_url = $imdbcfg->photodir . $imdb_id. $imdbcfg->imageext;
if (file_exists($photo_url))
$thumbnail = "<img width=\"101\" height=\"140\" src=\"".$photo_url."\" border=\"0\" alt=\"poster\" />";
else continue;
}
else continue;
$thumbnail = "<a href=\"details.php?id=" . $array['id'] . "&amp;hit=1\" onmouseover=\"domTT_activate(this, event, 'content', '" . htmlspecialchars("<font class=\'big\'><b>" . (addslashes($array['name'] . $pro_torrent)) . "</b></font><br /><font class=\'medium\'>".(addslashes($array['small_descr'])) ."</font>"). "', 'trail', true, 'delay', 0,'lifetime',5000,'styleClass','niceTitle','maxWidth', 600);\">" . $thumbnail . "</a>";
$movies_list .= $thumbnail;
$count++;
if ($count >= 9)
break;
}
?>
<h2><?php echo $lang_index['text_' . $type_each . 'movies'] ?></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="5"><tr><td class="text nowrap" align="center">
<?php echo $movies_list ?></td></tr></table>
<?php
}
$Cache->end_whole_row();
$Cache->cache_page();
}
echo $Cache->next_row();
}
}
}
// ------------- end: hot and classic movies ------------------//
// ------------- start: funbox ------------------//
if ($showfunbox_main == "yes" && (!isset($CURUSER) || $CURUSER['showfb'] == "yes")){
// Get the newest fun stuff
if (!$row = $Cache->get_value('current_fun_content')){
$result = sql_query("SELECT fun.*, IF(ADDTIME(added, '1 0:0:0') < NOW(),true,false) AS neednew FROM fun WHERE status != 'banned' AND status != 'dull' ORDER BY added DESC LIMIT 1") or sqlerr(__FILE__,__LINE__);
$row = mysql_fetch_array($result);
$Cache->cache_value('current_fun_content', $row, 1043);
}
if (!$row) //There is no funbox item
{
print("<h2>".$lang_index['text_funbox'].(get_user_class() >= $newfunitem_class ? "<font class=\"small\"> - [<a class=\"altlink\" href=\"fun.php?action=new\"><b>".$lang_index['text_new_fun']."</b></a>]</font>" : "")."</h2>");
}
else
{
$totalvote = $Cache->get_value('current_fun_vote_count');
if ($totalvote == ""){
$totalvote = get_row_count("funvotes", "WHERE funid = ".sqlesc($row['id']));
$Cache->cache_value('current_fun_vote_count', $totalvote, 756);
}
$funvote = $Cache->get_value('current_fun_vote_funny_count');
if ($funvote == ""){
$funvote = get_row_count("funvotes", "WHERE funid = ".sqlesc($row['id'])." AND vote='fun'");
$Cache->cache_value('current_fun_vote_funny_count', $funvote, 756);
}
//check whether current user has voted
$funvoted = get_row_count("funvotes", "WHERE funid = ".sqlesc($row['id'])." AND userid=".sqlesc($CURUSER['id']));
print ("<h2>".$lang_index['text_funbox']);
if ($CURUSER)
{
print("<font class=\"small\">".(get_user_class() >= $log_class ? " - [<a class=\"altlink\" href=\"log.php?action=funbox\"><b>".$lang_index['text_more_fun']."</b></a>]": "").($row['neednew'] && get_user_class() >= $newfunitem_class ? " - [<a class=altlink href=\"fun.php?action=new\"><b>".$lang_index['text_new_fun']."</b></a>]" : "" ).( ($CURUSER['id'] == $row['userid'] || get_user_class() >= $funmanage_class) ? " - [<a class=\"altlink\" href=\"fun.php?action=edit&amp;id=".$row['id']."&amp;returnto=index.php\"><b>".$lang_index['text_edit']."</b></a>]" : "").(get_user_class() >= $funmanage_class ? " - [<a class=\"altlink\" href=\"fun.php?action=delete&amp;id=".$row['id']."&amp;returnto=index.php\"><b>".$lang_index['text_delete']."</b></a>] - [<a class=\"altlink\" href=\"fun.php?action=ban&amp;id=".$row['id']."&amp;returnto=index.php\"><b>".$lang_index['text_ban']."</b></a>]" : "")."</font>");
}
print("</h2>");
print("<table width=\"100%\"><tr><td class=\"text\">");
print("<iframe src=\"fun.php?action=view\" width='900' height='300' frameborder='0' name='funbox' marginwidth='0' marginheight='0'></iframe><br /><br />\n");
if ($CURUSER)
{
$funonclick = " onclick=\"funvote(".$row['id'].",'fun'".")\"";
$dullonclick = " onclick=\"funvote(".$row['id'].",'dull'".")\"";
print("<span id=\"funvote\"><b>".$funvote."</b>".$lang_index['text_out_of'].$totalvote.$lang_index['text_people_found_it'].($funvoted ? "" : "<font class=\"striking\">".$lang_index['text_your_opinion']."</font>&nbsp;&nbsp;<input type=\"button\" class='btn' name='fun' id='fun' ".$funonclick." value=\"".$lang_index['submit_fun']."\" />&nbsp;<input type=\"button\" class='btn' name='dull' id='dull' ".$dullonclick." value=\"".$lang_index['submit_dull']."\" />")."</span><span id=\"voteaccept\" style=\"display: none;\">".$lang_index['text_vote_accepted']."</span>");
}
print("</td></tr></table>");
}
}
// ------------- end: funbox ------------------//
// ------------- start: shoutbox ------------------//
if ($showshoutbox_main == "yes") {
?>
<h2><?php echo $lang_index['text_shoutbox'] ?> - <font class="small"><?php echo $lang_index['text_auto_refresh_after']?></font><font class='striking' id="countdown"></font><font class="small"><?php echo $lang_index['text_seconds']?></font></h2>
<?php
print("<table width=\"100%\"><tr><td class=\"text\">\n");
print("<iframe src='shoutbox.php?type=shoutbox' width='900' height='180' frameborder='0' name='sbox' marginwidth='0' marginheight='0'></iframe><br /><br />\n");
print("<form action='shoutbox.php' method='get' target='sbox' name='shbox'>\n");
print("<label for='shbox_text'>".$lang_index['text_message']."</label><input type='text' name='shbox_text' id='shbox_text' size='100' style='width: 650px; border: 1px solid gray;' /> <input type='submit' id='hbsubmit' class='btn' name='shout' value=\"".$lang_index['sumbit_shout']."\" />");
if ($CURUSER['hidehb'] != 'yes' && $showhelpbox_main =='yes')
print("<input type='submit' class='btn' name='toguest' value=\"".$lang_index['sumbit_to_guest']."\" />");
print("<input type='reset' class='btn' value=\"".$lang_index['submit_clear']."\" /> <input type='hidden' name='sent' value='yes' /><input type='hidden' name='type' value='shoutbox' /><br />\n");
print(smile_row("shbox","shbox_text"));
print("</form></td></tr></table>");
}
// ------------- end: shoutbox ------------------//
// ------------- start: latest forum posts ------------------//
/*
if ($showlastxforumposts_main == "yes" && $CURUSER)
{
$res = sql_query("SELECT posts.id AS pid, posts.userid AS userpost, posts.added, topics.id AS tid, topics.subject, topics.forumid, topics.views, forums.name FROM posts, topics, forums WHERE posts.topicid = topics.id AND topics.forumid = forums.id AND minclassread <=" . sqlesc(get_user_class()) . " ORDER BY posts.id DESC LIMIT 5") or sqlerr(__FILE__,__LINE__);
if(mysql_num_rows($res) != 0)
{
print("<h2>".$lang_index['text_last_five_posts']."</h2>");
print("<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\"><tr><td class=\"colhead\" width=\"100%\" align=\"left\">".$lang_index['col_topic_title']."</td><td class=\"colhead\" align=\"center\">".$lang_index['col_view']."</td><td class=\"colhead\" align=\"center\">".$lang_index['col_author']."</td><td class=\"colhead\" align=\"left\">".$lang_index['col_posted_at']."</td></tr>");
while ($postsx = mysql_fetch_assoc($res))
{
print("<tr><td><a href=\"forums.php?action=viewtopic&amp;topicid=".$postsx["tid"]."&amp;page=p".$postsx["pid"]."#pid".$postsx["pid"]."\"><b>".htmlspecialchars($postsx["subject"])."</b></a><br />".$lang_index['text_in']."<a href=\"forums.php?action=viewforum&amp;forumid=".$postsx["forumid"]."\">".htmlspecialchars($postsx["name"])."</a></td><td align=\"center\">".$postsx["views"]."</td><td align=\"center\">" . get_username($postsx["userpost"]) ."</td><td>".gettime($postsx["added"])."</td></tr>");
}
print("</table>");
}
}
*/
// ------------- end: latest forum posts ------------------//
// ------------- start: latest torrents ------------------//
if ($showlastxtorrents_main == "yes") {
$result = sql_query("SELECT * FROM torrents where visible='yes' ORDER BY added DESC LIMIT 5") or sqlerr(__FILE__, __LINE__);
if(mysql_num_rows($result) != 0 )
{
print ("<h2>".$lang_index['text_last_five_torrent']."</h2>");
print ("<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\"><tr><td class=\"colhead\" width=\"100%\">".$lang_index['col_name']."</td><td class=\"colhead\" align=\"center\">".$lang_index['col_seeder']."</td><td class=\"colhead\" align=\"center\">".$lang_index['col_leecher']."</td></tr>");
while( $row = mysql_fetch_assoc($result) )
{
print ("<tr><a href=\"details.php?id=". $row['id'] ."&amp;hit=1\"><td><a href=\"details.php?id=". $row['id'] ."&amp;hit=1\"><b>" . htmlspecialchars($row['name']) . "</b></td></a><td align=\"center\">" . $row['seeders'] . "</td><td align=\"center\">" . $row['leechers'] . "</td></tr>");
}
print ("</table>");
}
}
// ------------- end: latest torrents ------------------//
// ------------- start: polls ------------------//
if ($CURUSER && $showpolls_main == "yes")
{
// Get current poll
if (!$arr = $Cache->get_value('current_poll_content')){
$res = sql_query("SELECT * FROM polls ORDER BY id DESC LIMIT 1") or sqlerr(__FILE__, __LINE__);
$arr = mysql_fetch_array($res);
$Cache->cache_value('current_poll_content', $arr, 7226);
}
if (!$arr)
$pollexists = false;
else $pollexists = true;
print("<h2>".$lang_index['text_polls']);
if (get_user_class() >= $pollmanage_class)
{
print("<font class=\"small\"> - [<a class=\"altlink\" href=\"makepoll.php?returnto=main\"><b>".$lang_index['text_new']."</b></a>]\n");
if ($pollexists)
{
print(" - [<a class=\"altlink\" href=\"makepoll.php?action=edit&amp;pollid=".$arr['id']."&amp;returnto=main\"><b>".$lang_index['text_edit']."</b></a>]\n");
print(" - [<a class=\"altlink\" href=\"log.php?action=poll&amp;do=delete&amp;pollid=".$arr['id']."&amp;returnto=main\"><b>".$lang_index['text_delete']."</b></a>]");
print(" - [<a class=\"altlink\" href=\"polloverview.php?id=".$arr['id']."\"><b>".$lang_index['text_detail']."</b></a>]");
}
print("</font>");
}
print("</h2>");
if ($pollexists)
{
$pollid = intval($arr["id"] ?? 0);
$question = $arr["question"];
$o = array($arr["option0"], $arr["option1"], $arr["option2"], $arr["option3"], $arr["option4"],
$arr["option5"], $arr["option6"], $arr["option7"], $arr["option8"], $arr["option9"],
$arr["option10"], $arr["option11"], $arr["option12"], $arr["option13"], $arr["option14"],
$arr["option15"], $arr["option16"], $arr["option17"], $arr["option18"], $arr["option19"]);
print("<table width=\"100%\"><tr><td class=\"text\" align=\"center\">\n");
print("<table width=\"59%\" class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\"><tr><td class=\"text\" align=\"left\">");
print("<p align=\"center\"><b>".$question."</b></p>\n");
// Check if user has already voted
$res = sql_query("SELECT selection FROM pollanswers WHERE pollid=".sqlesc($pollid)." AND userid=".sqlesc($CURUSER["id"])) or sqlerr();
$voted = mysql_fetch_assoc($res);
if ($voted) //user has already voted
{
$uservote = $voted["selection"];
$Cache->new_page('current_poll_result', 3652, true);
if (!$Cache->get_page())
{
// we reserve 255 for blank vote.
$res = sql_query("SELECT selection FROM pollanswers WHERE pollid=".sqlesc($pollid)." AND selection < 20") or sqlerr();
$tvotes = mysql_num_rows($res);
$vs = array();
$os = array();
// Count votes
while (($arr2 = mysql_fetch_row($res) !== null) && isset($arr2[0]) && isset($vs[$arr2[0]]))
$vs[$arr2[0]] ++;
reset($o);
for ($i = 0; $i < count($o); ++$i){
if (isset($vs[$i]) && isset($o[$i]) && $o[$i])
$os[$i] = array($vs[$i], $o[$i], $i);
}
function srt($a,$b)
{
if ($a[0] > $b[0]) return -1;
if ($a[0] < $b[0]) return 1;
return 0;
}
// now os is an array like this: array(array(123, "Option 1", 1), array(45, "Option 2", 2))
$Cache->add_whole_row();
print("<table class=\"main\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n");
$Cache->end_whole_row();
$i = 0;
while (isset($os[$i]))
{
$a = $os[$i];
if ($tvotes == 0)
$p = 0;
else
$p = round($a[0] / $tvotes * 100);
$Cache->add_row();
$Cache->add_part();
print("<tr><td width=\"1%\" class=\"embedded nowrap\">" . $a[1] . "&nbsp;&nbsp;</td><td width=\"99%\" class=\"embedded nowrap\"><img class=\"bar_end\" src=\"pic/trans.gif\" alt=\"\" /><img ");
$Cache->end_part();
$Cache->add_part();
print(" src=\"pic/trans.gif\" style=\"width: " . ($p * 3) ."px;\" alt=\"\" /><img class=\"bar_end\" src=\"pic/trans.gif\" alt=\"\" /> $p%</td></tr>\n");
$Cache->end_part();
$Cache->end_row();
++$i;
}
$Cache->break_loop();
$Cache->add_whole_row();
print("</table>\n");
$tvotes = number_format($tvotes);
print("<p align=\"center\">".$lang_index['text_votes']." ".$tvotes."</p>\n");
$Cache->end_whole_row();
$Cache->cache_page();
}
echo $Cache->next_row();
$i = 0;
while($Cache->next_row()){
echo $Cache->next_part();
if ($i == $uservote)
echo "class=\"sltbar\"";
else
echo "class=\"unsltbar\"";
echo $Cache->next_part();
$i++;
}
echo $Cache->next_row();
}
else //user has not voted yet
{
print("<form method=\"post\" action=\"index.php\">\n");
$i = 0;
while ($a = $o[$i])
{
print("<input type=\"radio\" name=\"choice\" value=\"".$i."\">".$a."<br />\n");
++$i;
}
print("<br />");
print("<input type=\"radio\" name=\"choice\" value=\"255\">".$lang_index['radio_blank_vote']."<br />\n");
print("<p align=\"center\"><input type=\"submit\" class=\"btn\" value=\"".$lang_index['submit_vote']."\" /></p>");
}
print("</td></tr></table>");
if ($voted && get_user_class() >= $log_class)
print("<p align=\"center\"><a href=\"log.php?action=poll\">".$lang_index['text_previous_polls']."</a></p>\n");
print("</td></tr></table>");
}
}
// ------------- end: polls ------------------//
// ------------- start: stats ------------------//
if ($showstats_main == "yes")
{
?>
<h2><?php echo $lang_index['text_tracker_statistics'] ?></h2>
<table width="100%"><tr><td class="text" align="center">
<table width="60%" class="main" border="1" cellspacing="0" cellpadding="10">
<?php
$Cache->new_page('stats_users', 3000, true);
if (!$Cache->get_page()){
$Cache->add_whole_row();
$registered = number_format(get_row_count("users"));
$unverified = number_format(get_row_count("users", "WHERE status='pending'"));
$totalonlinetoday = number_format(get_row_count("users","WHERE last_access >= ". sqlesc(date("Y-m-d H:i:s",(TIMENOW - 86400)))));
$totalonlineweek = number_format(get_row_count("users","WHERE last_access >= ". sqlesc(date("Y-m-d H:i:s",(TIMENOW - 604800)))));
$VIP = number_format(get_row_count("users", "WHERE class=".UC_VIP));
$donated = number_format(get_row_count("users", "WHERE donor = 'yes'"));
$warned = number_format(get_row_count("users", "WHERE warned='yes'"));
$disabled = number_format(get_row_count("users", "WHERE enabled='no'"));
$registered_male = number_format(get_row_count("users", "WHERE gender='Male'"));
$registered_female = number_format(get_row_count("users", "WHERE gender='Female'"));
?>
<tr>
<?php
twotd($lang_index['row_users_active_today'],$totalonlinetoday);
twotd($lang_index['row_users_active_this_week'],$totalonlineweek);
?>
</tr>
<tr>
<?php
twotd($lang_index['row_registered_users'],$registered." / ".number_format($maxusers));
twotd($lang_index['row_unconfirmed_users'],$unverified);
?>
</tr>
<tr>
<?php
twotd(get_user_class_name(UC_VIP,false,false,true),$VIP);
twotd($lang_index['row_donors']." <img class=\"star\" src=\"pic/trans.gif\" alt=\"Donor\" />",$donated);
?>
</tr>
<tr>
<?php
twotd($lang_index['row_warned_users']." <img class=\"warned\" src=\"pic/trans.gif\" alt=\"warned\" />",$warned);
twotd($lang_index['row_banned_users']." <img class=\"disabled\" src=\"pic/trans.gif\" alt=\"disabled\" />",$disabled);
?>
</tr>
<tr>
<?php
twotd($lang_index['row_male_users'],$registered_male);
twotd($lang_index['row_female_users'],$registered_female);
?>
</tr>
<?php
$Cache->end_whole_row();
$Cache->cache_page();
}
echo $Cache->next_row();
?>
<tr><td colspan="4" class="rowhead">&nbsp;</td></tr>
<?php
$Cache->new_page('stats_torrents', 1800, true);
if (!$Cache->get_page()){
$Cache->add_whole_row();
$torrents = number_format(get_row_count("torrents"));
$dead = number_format(get_row_count("torrents", "WHERE visible='no'"));
$seeders = get_row_count("peers", "WHERE seeder='yes'");
$leechers = get_row_count("peers", "WHERE seeder='no'");
if ($leechers == 0)
$ratio = 0;
else
$ratio = round($seeders / $leechers * 100);
$activewebusernow = get_row_count("users","WHERE last_access >= ".sqlesc(date("Y-m-d H:i:s",(TIMENOW - 900))));
$activewebusernow=number_format($activewebusernow);
$activetrackerusernow = number_format(get_single_value("peers","COUNT(DISTINCT(userid))"));
$peers = number_format($seeders + $leechers);
$seeders = number_format($seeders);
$leechers = number_format($leechers);
$totaltorrentssize = mksize(get_row_sum("torrents", "size"));
$totaluploaded = get_row_sum("users","uploaded");
$totaldownloaded = get_row_sum("users","downloaded");
$totaldata = $totaldownloaded+$totaluploaded;
?>
<tr>
<?php
twotd($lang_index['row_torrents'],$torrents);
twotd($lang_index['row_dead_torrents'],$dead);
?>
</tr>
<tr>
<?php
twotd($lang_index['row_seeders'],$seeders);
twotd($lang_index['row_leechers'],$leechers);
?>
</tr>
<tr>
<?php
twotd($lang_index['row_peers'],$peers);
twotd($lang_index['row_seeder_leecher_ratio'],$ratio."%");
?>
</tr>
<tr>
<?php
twotd($lang_index['row_active_browsing_users'], $activewebusernow);
twotd($lang_index['row_tracker_active_users'], $activetrackerusernow);
?>
</tr>
<tr>
<?php
twotd($lang_index['row_total_size_of_torrents'],$totaltorrentssize);
twotd($lang_index['row_total_uploaded'],mksize($totaluploaded));
?>
</tr>
<tr>
<?php
twotd($lang_index['row_total_downloaded'],mksize($totaldownloaded));
twotd($lang_index['row_total_data'],mksize($totaldata));
?>
</tr>
<?php
$Cache->end_whole_row();
$Cache->cache_page();
}
echo $Cache->next_row();
?>
<tr><td colspan="4" class="rowhead">&nbsp;</td></tr>
<?php
$Cache->new_page('stats_classes', 4535, true);
if (!$Cache->get_page()){
$Cache->add_whole_row();
$peasants = number_format(get_row_count("users", "WHERE class=".UC_PEASANT));
$users = number_format(get_row_count("users", "WHERE class=".UC_USER));
$powerusers = number_format(get_row_count("users", "WHERE class=".UC_POWER_USER));
$eliteusers = number_format(get_row_count("users", "WHERE class=".UC_ELITE_USER));
$crazyusers = number_format(get_row_count("users", "WHERE class=".UC_CRAZY_USER));
$insaneusers = number_format(get_row_count("users", "WHERE class=".UC_INSANE_USER));
$veteranusers = number_format(get_row_count("users", "WHERE class=".UC_VETERAN_USER));
$extremeusers = number_format(get_row_count("users", "WHERE class=".UC_EXTREME_USER));
$ultimateusers = number_format(get_row_count("users", "WHERE class=".UC_ULTIMATE_USER));
$nexusmasters = number_format(get_row_count("users", "WHERE class=".UC_NEXUS_MASTER));
?>
<tr>
<?php
twotd(get_user_class_name(UC_PEASANT,false,false,true)." <img class=\"leechwarned\" src=\"pic/trans.gif\" alt=\"leechwarned\" />",$peasants);
twotd(get_user_class_name(UC_USER,false,false,true),$users);
?>
</tr>
<tr>
<?php
twotd(get_user_class_name(UC_POWER_USER,false,false,true),$powerusers);
twotd(get_user_class_name(UC_ELITE_USER,false,false,true),$eliteusers);
?>
</tr>
<tr>
<?php
twotd(get_user_class_name(UC_CRAZY_USER,false,false,true),$crazyusers);
twotd(get_user_class_name(UC_INSANE_USER,false,false,true),$insaneusers);
?>
</tr>
<tr>
<?php
twotd(get_user_class_name(UC_VETERAN_USER,false,false,true),$veteranusers);
twotd(get_user_class_name(UC_EXTREME_USER,false,false,true),$extremeusers);
?>
</tr>
<tr>
<?php
twotd(get_user_class_name(UC_ULTIMATE_USER,false,false,true),$ultimateusers);
twotd(get_user_class_name(UC_NEXUS_MASTER,false,false,true),$nexusmasters);
?>
</tr>
<?php
$Cache->end_whole_row();
$Cache->cache_page();
}
echo $Cache->next_row();
?>
</table>
</td></tr></table>
<?php
}
// ------------- end: stats ------------------//
// ------------- start: tracker load ------------------//
if ($showtrackerload == "yes") {
$uptimeresult=exec('uptime');
if ($uptimeresult){
?>
<h2><?php echo $lang_index['text_tracker_load'] ?></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="10"><tr><td class="text" align="center">
<?php
//uptime, work in *nix system
print ("<div align=\"center\">" . trim($uptimeresult) . "</div>");
print("</td></tr></table>");
}
}
// ------------- end: tracker load ------------------//
// ------------- start: disclaimer ------------------//
?>
<h2><?php echo $lang_index['text_disclaimer'] ?></h2>
<table width="100%"><tr><td class="text">
<?php echo $lang_index['text_disclaimer_content'] ?></td></tr></table>
<?php
// ------------- end: disclaimer ------------------//
// ------------- start: links ------------------//
print("<h2>".$lang_index['text_links']);
if (get_user_class() >= $applylink_class)
print("<font class=\"small\"> - [<a class=\"altlink\" href=\"linksmanage.php?action=apply\"><b>".$lang_index['text_apply_for_link']."</b></a>]</font>");
if (get_user_class() >= $linkmanage_class)
{
print("<font class=\"small\">");
print(" - [<a class=\"altlink\" href=\"linksmanage.php\"><b>".$lang_index['text_manage_links']."</b></a>]\n");
print("</font>");
}
print("</h2>");
$Cache->new_page('links', 86400, false);
if (!$Cache->get_page()){
$Cache->add_whole_row();
$res = sql_query("SELECT * FROM links ORDER BY id ASC") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
{
$links = "";
while($array = mysql_fetch_array($res))
{
$links .= "<a href=\"" . $array['url'] . "\" title=\"" . $array['title'] . "\" target=\"_blank\">" . $array['name'] . "</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
}
print("<table width=\"100%\"><tr><td class=\"text\">".trim($links)."</td></tr></table>");
}
$Cache->end_whole_row();
$Cache->cache_page();
}
echo $Cache->next_row();
// ------------- end: links ------------------//
// ------------- start: browser, client and code note ------------------//
?>
<table width="100%" class="main" border="0" cellspacing="0" cellpadding="0"><tr><td class="embedded">
<div align="center"><br /><font class="medium"><?php echo $lang_index['text_browser_note'] ?></font></div>
<div align="center"><a href="http://www.nexusphp.com" title="<?php echo PROJECTNAME?>" target="_blank"><img src="pic/nexus.png" alt="<?php echo PROJECTNAME?>" /></a></div>
</td></tr></table>
<?php
// ------------- end: browser, client and code note ------------------//
if ($CURUSER)
$USERUPDATESET[] = "last_home = ".sqlesc(date("Y-m-d H:i:s"));
$Cache->delete_value('user_'.$CURUSER["id"].'_unread_news_count');
end_main_frame();
stdfoot();
?>
+153
View File
@@ -0,0 +1,153 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
parked();
$id = intval($_GET["id"] ?? 0);
$type = unesc($_GET["type"] ?? '');
registration_check('invitesystem',true,false);
if (($CURUSER['id'] != $id && get_user_class() < $viewinvite_class) || !is_valid_id($id))
stderr($lang_invite['std_sorry'],$lang_invite['std_permission_denied']);
if (get_user_class() < $sendinvite_class)
stderr($lang_invite['std_sorry'],$lang_invite['std_only'].get_user_class_name($sendinvite_class,false,true,true).$lang_invite['std_or_above_can_invite'],false);
$res = sql_query("SELECT username FROM users WHERE id = ".mysql_real_escape_string($id)) or sqlerr();
$user = mysql_fetch_assoc($res);
stdhead($lang_invite['head_invites']);
print("<table width=700 class=main border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>");
print("<h1 align=center><a href=\"invite.php?id=".$id."\">".$user['username'].$lang_invite['text_invite_system']."</a></h1>");
$sent = htmlspecialchars($_GET['sent'] ?? '');
if ($sent == 1){
$msg = $lang_invite['text_invite_code_sent'];
print("<p align=center><font color=red>".$msg."</font></p>");
}
$res = sql_query("SELECT invites FROM users WHERE id = ".mysql_real_escape_string($id)) or sqlerr();
$inv = mysql_fetch_assoc($res);
//for one or more. "invite"/"invites"
if ($inv["invites"] != 1){
$_s = $lang_invite['text_s'];
} else {
$_s = "";
}
if ($type == 'new'){
if ($CURUSER[invites] <= 0) {
stdmsg($lang_invite['std_sorry'],$lang_invite['std_no_invites_left'].
"<a class=altlink href=invite.php?id=$CURUSER[id]>".$lang_invite['here_to_go_back'],false);
print("</td></tr></table>");
stdfoot();
die;
}
$invitation_body = $lang_invite['text_invitation_body'].$CURUSER[username];
//$invitation_body_insite = str_replace("<br />","\n",$invitation_body);
print("<form method=post action=takeinvite.php?id=".htmlspecialchars($id).">".
"<table border=1 width=737 cellspacing=0 cellpadding=5>".
"<tr align=center><td colspan=2><b>".$lang_invite['text_invite_someone']."$SITENAME ($inv[invites]".$lang_invite['text_invitation'].$_s.$lang_invite['text_left'] .")</b></td></tr>".
"<tr><td class=\"rowhead nowrap\" valign=\"top\" align=\"right\">".$lang_invite['text_email_address']."</td><td align=left><input type=text size=40 name=email><br /><font align=left class=small>".$lang_invite['text_email_address_note']."</font>".($restrictemaildomain == 'yes' ? "<br />".$lang_invite['text_email_restriction_note'].allowedemails() : "")."</td></tr>".
"<tr><td class=\"rowhead nowrap\" valign=\"top\" align=\"right\">".$lang_invite['text_message']."</td><td align=left><textarea name=body rows=8 cols=120>" .$invitation_body.
"</textarea></td></tr>".
"<tr><td align=center colspan=2><input type=submit value='".$lang_invite['submit_invite']."'></td></tr>".
"</form></table></td></tr></table>");
} else {
$rel = sql_query("SELECT COUNT(*) FROM users WHERE invited_by = ".mysql_real_escape_string($id)) or sqlerr(__FILE__, __LINE__);
$arro = mysql_fetch_row($rel);
$number = $arro[0];
$ret = sql_query("SELECT id, username, email, uploaded, downloaded, status, warned, enabled, donor, email FROM users WHERE invited_by = ".mysql_real_escape_string($id)) or sqlerr();
$num = mysql_num_rows($ret);
print("<table border=1 width=737 cellspacing=0 cellpadding=5>".
"<h2 align=center>".$lang_invite['text_invite_status']." ($number)</h2><form method=post action=takeconfirm.php?id=".htmlspecialchars($id).">");
if(!$num){
print("<tr><td colspan=7 align=center>".$lang_invite['text_no_invites']."</tr>");
} else {
print("<tr><td class=colhead><b>".$lang_invite['text_username']."</b></td><td class=colhead><b>".$lang_invite['text_email']."</b></td><td class=colhead><b>".$lang_invite['text_uploaded']."</b></td><td class=colhead><b>".$lang_invite['text_downloaded']."</b></td><td class=colhead><b>".$lang_invite['text_ratio']."</b></td><td class=colhead><b>".$lang_invite['text_status']."</b></td>");
if ($CURUSER[id] == $id || get_user_class() >= UC_SYSOP)
print("<td class=colhead><b>".$lang_invite['text_confirm']."</b></td>");
print("</tr>");
for ($i = 0; $i < $num; ++$i)
{
$arr = mysql_fetch_assoc($ret);
$user = "<td class=rowfollow>" . get_username($arr[id]) . "</td>";
if ($arr["downloaded"] > 0) {
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";
} else {
if ($arr["uploaded"] > 0) {
$ratio = "Inf.";
}
else {
$ratio = "---";
}
}
if ($arr["status"] == 'confirmed')
$status = "<a href=userdetails.php?id=$arr[id]><font color=#1f7309>".$lang_invite['text_confirmed']."</font></a>";
else
$status = "<a href=checkuser.php?id=$arr[id]><font color=#ca0226>".$lang_invite['text_pending']."</font></a>";
print("<tr class=rowfollow>$user<td>$arr[email]</td><td class=rowfollow>" . mksize($arr[uploaded]) . "</td><td class=rowfollow>" . mksize($arr[downloaded]) . "</td><td class=rowfollow>$ratio</td><td class=rowfollow>$status</td>");
if ($CURUSER[id] == $id || get_user_class() >= UC_SYSOP){
print("<td>");
if ($arr[status] == 'pending')
print("<input type=\"checkbox\" name=\"conusr[]\" value=\"" . $arr[id] . "\" />");
print("</td>");
}
print("</tr>");
}
}
if ($CURUSER['id'] == $id || get_user_class() >= UC_SYSOP)
{
$pendingcount = number_format(get_row_count("users", "WHERE status='pending' AND invited_by=$CURUSER[id]"));
if ($pendingcount){
print("<input type=hidden name=email value=$arr[email]>");
print("<tr><td colspan=7 align=right><input type=submit style='height: 20px' value=".$lang_invite['submit_confirm_users']."></td></tr>");
}
print("</form>");
print("<tr><td colspan=7 align=center><form method=post action=invite.php?id=".htmlspecialchars($id)."&type=new><input type=submit ".($CURUSER['invites'] <= 0 ? "disabled " : "")." value='".$lang_invite['sumbit_invite_someone']."'></form></td></tr>");
}
print("</table>");
$rul = sql_query("SELECT COUNT(*) FROM invites WHERE inviter =".mysql_real_escape_string($id)) or sqlerr();
$arre = mysql_fetch_row($rul);
$number1 = $arre[0];
$rer = sql_query("SELECT invitee, hash, time_invited FROM invites WHERE inviter = ".mysql_real_escape_string($id)) or sqlerr();
$num1 = mysql_num_rows($rer);
print("<table border=1 width=737 cellspacing=0 cellpadding=5>".
"<h2 align=center>".$lang_invite['text_sent_invites_status']." ($number1)</h2>");
if(!$num1){
print("<tr align=center><td colspan=6>".$lang_invite['text_no_invitation_sent']."</tr>");
} else {
print("<tr><td class=colhead>".$lang_invite['text_email']."</td><td class=colhead>".$lang_invite['text_hash']."</td><td class=colhead>".$lang_invite['text_send_date']."</td></tr>");
for ($i = 0; $i < $num1; ++$i)
{
$arr1 = mysql_fetch_assoc($rer);
print("<tr><td class=rowfollow>$arr1[invitee]<td class=rowfollow>$arr1[hash]</td><td class=rowfollow>$arr1[time_invited]</td></tr>");
}
}
print("</table>");
print("</td></tr></table>");
}
stdfoot();
die;
?>
+84
View File
@@ -0,0 +1,84 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_MODERATOR)
stderr("Sorry", "Access denied.");
stdhead("Duplicate IP users");
begin_frame("Duplicate IP users:", true);
begin_table();
if (get_user_class() >= UC_MODERATOR || $CURUSER["guard"] == "yes")
{
$res = sql_query("SELECT count(*) AS dupl, ip FROM users WHERE enabled = 'yes' AND ip <> '' AND ip <> '127.0.0.0' GROUP BY ip ORDER BY dupl DESC, ip") or sqlerr();
print("<tr align=center><td class=colhead width=90>User</td>
<td class=colhead width=70>Email</td>
<td class=colhead width=70>Registered</td>
<td class=colhead width=75>Last access</td>
<td class=colhead width=70>Downloaded</td>
<td class=colhead width=70>Uploaded</td>
<td class=colhead width=45>Ratio</td>
<td class=colhead width=125>IP</td>
<td class=colhead width=40>Peer</td></tr>\n");
$uc = 0;
$ip = '';
while($ras = mysql_fetch_assoc($res))
{
if ($ras["dupl"] <= 1)
break;
if ($ip <> $ras['ip'])
{
$ros = sql_query("SELECT id, username, email, added, last_access, downloaded, uploaded, ip, warned, donor, enabled FROM users WHERE ip='".$ras['ip']."' ORDER BY id") or sqlerr();
$num2 = mysql_num_rows($ros);
if ($num2 > 1)
{
$uc++;
while($arr = mysql_fetch_assoc($ros))
{
if ($arr['added'] == '0000-00-00 00:00:00')
$arr['added'] = '-';
if ($arr['last_access'] == '0000-00-00 00:00:00')
$arr['last_access'] = '-';
if($arr["downloaded"] != 0)
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
else
$ratio="---";
$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";
$uploaded = mksize($arr["uploaded"]);
$downloaded = mksize($arr["downloaded"]);
$added = substr($arr['added'],0,10);
$last_access = substr($arr['last_access'],0,10);
if($uc%2 == 0)
$utc = "";
else
$utc = " bgcolor=\"ECE9D8\"";
$peer_res = sql_query("SELECT count(*) FROM peers WHERE ip = " . sqlesc($ras['ip']) . " AND userid = " . $arr['id']);
$peer_row = mysql_fetch_row($peer_res);
print("<tr$utc><td align=left>" . get_username($arr["id"])."</td>
<td align=center>$arr[email]</td>
<td align=center>$added</td>
<td align=center>$last_access</td>
<td align=center>$downloaded</td>
<td align=center>$uploaded</td>
<td align=center>$ratio</td>
<td align=center><a href=\"http://www.whois.sc/$arr[ip]\" target=\"_blank\">$arr[ip]</a></td>\n<td align=center>" .
($peer_row[0] ? "ja" : "nein") . "</td></tr>\n");
$ip = $arr["ip"];
}
}
}
}
}
else
{
print("<br /><table width=60% border=1 cellspacing=0 cellpadding=9><tr><td align=center>");
print("<h2>Sorry, only for Team</h2></table></td></tr>");
}
end_frame();
end_table();
stdfoot();
?>
+91
View File
@@ -0,0 +1,91 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
if (get_user_class() < $userprofile_class)
permissiondenied();
$userid = intval($_GET["id"] ?? 0);
if (!is_valid_id($userid))
stderr($lang_iphistory['std_error'], $lang_iphistory['std_invalid_id']);
$res = sql_query("SELECT username FROM users WHERE id = $userid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
stderr($lang_iphistory['error'], $lang_iphistory['text_user_not_found']);
$arr = mysql_fetch_array($res);
$username = $arr["username"];
$perpage = 20;
$ipcountres = sql_query("SELECT COUNT(DISTINCT(access)) FROM iplog WHERE userid = $userid");
$ipcountres = mysql_fetch_row($ipcountres);
$countrows = $ipcountres[0]+1;
$order = $_GET['order'] ?? '';
list($pagertop, $pagerbottom, $limit) = pager($perpage, $countrows, "iphistory.php?id=$userid&order=$order&");
$query = "SELECT u.id, u.ip AS ip, last_access AS access FROM users as u WHERE u.id = $userid
UNION DISTINCT SELECT u.id, iplog.ip as ip, iplog.access as access FROM users AS u
RIGHT JOIN iplog on u.id = iplog.userid WHERE u.id = $userid ORDER BY access DESC $limit";
$res = sql_query($query) or sqlerr(__FILE__, __LINE__);
stdhead($lang_iphistory['head_ip_history_log_for'].$username);
begin_main_frame();
print("<h1 align=\"center\">".$lang_iphistory['text_historical_ip_by'] . get_username($userid)."</h1>");
if ($countrows > $perpage)
echo $pagertop;
print("<table width=500 border=1 cellspacing=0 cellpadding=5 align=center>\n");
print("<tr>\n
<td class=colhead>".$lang_iphistory['col_last_access']."</td>\n
<td class=colhead>".$lang_iphistory['col_ip']."</td>\n
<td class=colhead>".$lang_iphistory['col_hostname']."</td>\n
</tr>\n");
while ($arr = mysql_fetch_array($res))
{
$addr = "";
$ipshow = "";
if ($arr["ip"])
{
$ip = $arr["ip"];
$dom = @gethostbyaddr($arr["ip"]);
if ($dom == $arr["ip"] || @gethostbyname($dom) != $arr["ip"])
$addr = $lang_iphistory['text_not_available'];
else
$addr = $dom;
$queryc = "SELECT COUNT(*) FROM
(
SELECT u.id FROM users AS u WHERE u.ip = " . sqlesc($ip) . "
UNION SELECT u.id FROM users AS u RIGHT JOIN iplog ON u.id = iplog.userid WHERE iplog.ip = " . sqlesc($ip) . "
GROUP BY u.id
) AS ipsearch";
$resip = sql_query($queryc) or sqlerr(__FILE__, __LINE__);
$arrip = mysql_fetch_row($resip);
$ipcount = $arrip[0];
if ($ipcount > 1)
$ipshow = "<a href=\"ipsearch.php?ip=". $arr['ip'] ."\">" . $arr['ip'] ."</a> <b>(<font class='striking'>".$lang_iphistory['text_duplicate']."</font>)</b>";
else
$ipshow = "<a href=\"ipsearch.php?ip=". $arr['ip'] ."\">" . $arr['ip'] ."</a>";
}
$date = gettime($arr["access"]);
print("<tr><td>".$date."</td>\n");
print("<td>".$ipshow."</td>\n");
print("<td>".$addr."</td></tr>\n");
}
print("</table>");
echo $pagerbottom;
end_main_frame();
stdfoot();
die;
?>
+170
View File
@@ -0,0 +1,170 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
if (get_user_class() < $userprofile_class)
permissiondenied();
else
{
$ip = trim($_GET['ip']);
if ($ip)
{
$regex = "/^(((1?\d{1,2})|(2[0-4]\d)|(25[0-5]))(\.\b|$)){4}$/";
if (!preg_match($regex, $ip))
{
stderr($lang_ipsearch['std_error'], $lang_ipsearch['std_invalid_ip']);
}
}
$mask = trim($_GET['mask'] ?? '');
if ($mask == "" || $mask == "255.255.255.255")
{
$where1 = "u.ip = '$ip'";
$where2 = "iplog.ip = '$ip'";
$dom = @gethostbyaddr($ip);
if ($dom == $ip || @gethostbyname($dom) != $ip)
$addr = "";
else
$addr = $dom;
}
else
{
if (substr($mask,0,1) == "/")
{
$n = substr($mask, 1, strlen($mask) - 1);
if (!is_numeric($n) or $n < 0 or $n > 32)
{
stderr($lang_ipsearch['std_error'], $lang_ipsearch['std_invalid_subnet_mask']);
}
else
$mask = long2ip(pow(2,32) - pow(2,32-$n));
}
elseif (!preg_match($regex, $mask))
{
stderr($lang_ipsearch['std_error'], $lang_ipsearch['std_invalid_subnet_mask']);
}
$where1 = "INET_ATON(u.ip) & INET_ATON('$mask') = INET_ATON('$ip') & INET_ATON('$mask')";
$where2 = "INET_ATON(iplog.ip) & INET_ATON('$mask') = INET_ATON('$ip') & INET_ATON('$mask')";
$addr = "Mask: $mask";
}
stdhead($lang_ipsearch['head_search_ip_history']);
begin_main_frame();
print("<h1 align=\"center\">".$lang_ipsearch['text_search_ip_history']."</h1>\n");
print("<form method=\"get\" action=\"".$_SERVER['PHP_SELF']."\">");
print("<table align=center border=1 cellspacing=0 width=115 cellpadding=5>\n");
tr($lang_ipsearch['row_ip']."<font color=red>*</font>", "<input type=\"text\" name=\"ip\" size=\"40\" value=\"".htmlspecialchars($ip)."\" />", 1);
tr("<nobr>".$lang_ipsearch['row_subnet_mask']."</nobr>", "<input type=\"text\" name=\"mask\" size=\"40\" value=\"" . htmlspecialchars($mask) . "\" />", 1);
print("<tr><td align=\"right\" colspan=\"2\"><input type=\"submit\" value=\"".$lang_ipsearch['submit_search']."\"/></td></tr>");
print("</table></form>\n");
if ($ip)
{
$queryc = "SELECT COUNT(*) FROM
(
SELECT u.id FROM users AS u WHERE $where1
UNION SELECT u.id FROM users AS u RIGHT JOIN iplog ON u.id = iplog.userid WHERE $where2
GROUP BY u.id
) AS ipsearch";
$res = sql_query($queryc) or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_array($res);
$count = $row[0];
if ($count == 0)
{
print("<p align=\"center\">".$lang_ipsearch['text_no_users_found']."</p>\n");
end_main_frame();
stdfoot();
die;
}
$order = $_GET['order'] ?? '';
$page = intval($_GET["page"] ?? 0);
$perpage = 20;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "$_SERVER[PHP_SELF]?ip=$ip&mask=$mask&order=$order&");
if ($order == "added")
$orderby = "added DESC";
elseif ($order == "username")
$orderby = "UPPER(username) ASC";
elseif ($order == "email")
$orderby = "email ASC";
elseif ($order == "last_ip")
$orderby = "last_ip ASC";
elseif ($order == "last_access")
$orderby = "last_ip ASC";
else
$orderby = "access DESC";
$query = "SELECT * FROM (
SELECT u.id, u.username, u.ip AS ip, u.ip AS last_ip, u.last_access, u.last_access AS access, u.email, u.invited_by, u.added, u.class, u.uploaded, u.downloaded, u.donor, u.enabled, u.warned
FROM users AS u
WHERE $where1
UNION SELECT u.id, u.username, iplog.ip AS ip, u.ip as last_ip, u.last_access, max(iplog.access) AS access, u.email, u.invited_by, u.added, u.class, u.uploaded, u.downloaded, u.donor, u.enabled, u.warned
FROM users AS u
RIGHT JOIN iplog ON u.id = iplog.userid
WHERE $where2
GROUP BY u.id ) as ipsearch
GROUP BY id
ORDER BY $orderby
$limit";
$res = sql_query($query) or sqlerr(__FILE__, __LINE__);
print("<h1 align=\"center\">".$count.$lang_ipsearch['text_users_used_the_ip'].$ip."</h1>");
print("<table width=940 border=1 cellspacing=0 cellpadding=5 align=center>\n");
print("<tr><td class=colhead align=center><a class=colhead href=\"?ip=$ip&mask=$mask&order=username\">".$lang_ipsearch['col_username']."</a></td>".
"<td class=colhead align=center><a class=colhead href=\"?ip=$ip&mask=$mask&order=last_ip\">".$lang_ipsearch['col_last_ip']."</a></td>".
"<td class=colhead align=center><a class=colhead href=\"?ip=$ip&mask=$mask&order=last_access\">".$lang_ipsearch['col_last_access']."</a></td>".
"<td class=colhead align=center>".$lang_ipsearch['col_ip_num']."</td>".
"<td class=colhead align=center><a class=colhead href=\"?ip=$ip&mask=$mask\">".$lang_ipsearch['col_last_access_on']."</a></td>".
"<td class=colhead align=center><a class=colhead href=\"?ip=$ip&mask=$mask&order=added\">".$lang_ipsearch['col_added']."</a></td>".
"<td class=colhead align=center>".$lang_ipsearch['col_invited_by']."</td>");
while ($user = mysql_fetch_array($res))
{
if ($user['added'] == '0000-00-00 00:00:00')
$added = $lang_ipsearch['text_not_available'];
else $added = gettime($user['added']);
if ($user['last_access'] == '0000-00-00 00:00:00')
$lastaccess = $lang_ipsearch['text_not_available'];
else $lastaccess = gettime($user['last_access']);
if ($user['last_ip'])
$ipstr = $user['last_ip'];
else
$ipstr = $lang_ipsearch['text_not_available'];
$resip = sql_query("SELECT ip FROM iplog WHERE userid=" . sqlesc($user['id']) . " GROUP BY iplog.ip") or sqlerr(__FILE__, __LINE__);
$iphistory = mysql_num_rows($resip);
if ($user["invited_by"] > 0)
{
$invited_by = get_username($user['invited_by']);
}
else
$invited_by = $lang_ipsearch['text_not_available'];
echo "<tr><td align=\"center\">" .
get_username($user['id'])."</td>".
"<td align=\"center\">" . $ipstr . "</td>
<td align=\"center\">" . $lastaccess . "</td>
<td align=\"center\"><a href=\"iphistory.php?id=" . $user['id'] . "\">" . $iphistory. "</a></td>
<td align=\"center\">" . gettime($user['access']) . "</td>
<td align=\"center\">" . gettime($user['added']) . "</td>
<td align=\"center\">" . $invited_by . "</td>
</tr>\n";
}
echo "</table>";
echo $pagerbottom;
}
end_main_frame();
stdfoot();
}
?>
+168
View File
@@ -0,0 +1,168 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
//start apply for links
if ($_GET['action'] == "apply")
{
if (get_user_class() >= $applylink_class){
stdhead($lang_linksmanage['head_apply_for_links']);
begin_main_frame();
begin_frame($lang_linksmanage['text_apply_for_links'], true,10,"100%","center");
print("<p align=left><b><font size=5>".$lang_linksmanage['text_rules']."</font></b></p>\n");
print("<p align=left>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ".$lang_linksmanage['text_rule_one']."</p>\n");
print("<p align=left>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ".$lang_linksmanage['text_rule_two']."</p>\n");
print("<p align=left>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ".$lang_linksmanage['text_rule_three']."</p>\n");
print("<p align=left>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ".$lang_linksmanage['text_rule_four']."</p>\n");
print("<p align=left>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ".$lang_linksmanage['text_rule_five']."</p>\n");
print("<p align=left>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ".$lang_linksmanage['text_rule_six']."</p>\n");
print("<p>".$lang_linksmanage['text_red_star_required']."</p>");
?>
<form method=post action="<?php echo $_SERVER["PHP_SELF"];?>">
<table table class=main border=1 cellspacing=0 cellpadding=5>
<tr><td class=rowhead><?php echo $lang_linksmanage['text_site_name']?><font color=red>*</font></td><td class=rowfollow align=left><input type=text name=linkname style="width: 200px">&nbsp;&nbsp;<font class=small><?php echo $lang_linksmanage['text_sitename_note']?></font></td></tr>
<tr><td class=rowhead><?php echo $lang_linksmanage['text_url']?><font color=red>*</font></td><td class=rowfollow align=left><input type=text name=url style="width: 200px">&nbsp;&nbsp;<font class=small><?php echo $lang_linksmanage['text_url_note']?></font></td></tr>
<tr><td class=rowhead><?php echo $lang_linksmanage['text_title']?></td><td class=rowfollow align=left><input type=text name=title style="width: 200px">&nbsp;&nbsp;<font class=small><?php echo $lang_linksmanage['text_title_note']?></font></td></tr>
<tr><td class=rowhead><?php echo $lang_linksmanage['text_administrator']?><font color=red>*</font></td><td class=rowfollow align=left><input type=text name=admin style="width: 200px">&nbsp;&nbsp;<font class=small><?php echo $lang_linksmanage['text_administrator_note']?></font></td></tr>
<tr><td class=rowhead><?php echo $lang_linksmanage['text_email']?><font color=red>*</font></td><td class=rowfollow align=left><input type=text name=email style="width: 200px">&nbsp;&nbsp;<font class=small><?php echo $lang_linksmanage['text_email_note']?></font></td></tr>
<tr><td class=rowhead><?php echo $lang_linksmanage['text_reason']?><font color=red>*</font></td><td class=rowfollow align=left><textarea name=reason style="width: 400px" rows=10></textarea></td></tr>
<tr><td colspan=2 align=center><input type="hidden" name="action" value="newapply"><input type=submit value="<?php echo $lang_linksmanage['submit_okay']?>" class=btn><input type=reset class=btn value="<?php echo $lang_linksmanage['submit_reset']?>"></td></tr>
</table>
</form>
<?php
end_frame();
end_main_frame();
stdfoot();
}
else permissiondenied();
}
elseif ($_POST['action'] == "newapply")
{
if (get_user_class() >= $applylink_class){
$sitename = unesc($_POST["linkname"]);
$url = unesc($_POST["url"]);
$title = unesc($_POST["title"]);
$admin = unesc($_POST["admin"]);
$email = htmlspecialchars(trim($_POST['email']));
$email = safe_email($email);
$reason = unesc($_POST["reason"]);
if (!$sitename)
stderr($lang_linksmanage['std_error'], $lang_linksmanage['std_no_sitename']);
elseif (!$url)
stderr($lang_linksmanage['std_error'], $lang_linksmanage['std_no_url']);
elseif (!$admin)
stderr($lang_linksmanage['std_error'], $lang_linksmanage['std_no_admin']);
elseif (!$email)
stderr($lang_linksmanage['std_error'], $lang_linksmanage['std_no_email']);
elseif (!check_email($email))
stderr($lang_linksmanage['std_error'], $lang_linksmanage['std_invalid_email']);
elseif (!$reason)
stderr($lang_linksmanage['std_error'], $lang_linksmanage['std_no_reason']);
elseif (strlen($reason) < 20)
stderr($lang_linksmanage['std_error'], $lang_linksmanage['std_reason_too_short']);
else{
$message = "[b]Sitename[/b]: ".$sitename."\n[b]URL[/b]: ".$url."\n[b]Title[/b]: ".$title."\n[b]Administrator: [/b]".$admin."\n[b]EMail[/b]: ".$email."\n[b]Reason[/b]: \n".$reason."\n";
$message = sqlesc($message);
$subject = $sitename." applys for links";
$subject = sqlesc($subject);
$added = "'" . date("Y-m-d H:i:s") . "'";
$userid = $CURUSER['id'];
sql_query("INSERT INTO staffmessages (sender, added, msg, subject) VALUES($userid, $added, $message, $subject)") or sqlerr(__FILE__, __LINE__);
stderr($lang_linksmanage['std_success'], $lang_linksmanage['std_success_note']);
}
}
else permissiondenied();
}
//start admin work
elseif (get_user_class() < $linkmanage_class)
permissiondenied();
else{
if ($_GET['action'] == "del") {
$id = intval($_GET['id'] ?? 0);
if (!$id) { header("Location: linksmanage.php"); die();}
$result = sql_query ("SELECT * FROM links where id = '".$id."'");
if ($row = mysql_fetch_array($result))
do {
sql_query ("DELETE FROM links where id = '".$row["id"]."'") or sqlerr(__FILE__, __LINE__);
} while($row = mysql_fetch_array($result));
$Cache->delete_value('links');
header("Location: linksmanage.php");
die();
}
if ($_POST['action'] == "editlink") {
$name = ($_POST['linkname']);
$url = ($_POST['url']);
$title = ($_POST['title']);
if (!$name && !$url && !$title) { header("Location: linksmanage.php"); die();}
sql_query("UPDATE links SET name = ".sqlesc($_POST['linkname']).", url = ".sqlesc($_POST['url']).", title = ".sqlesc($_POST['title'])." WHERE id = '".$_POST['id']."'") or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('links');
header("Location: linksmanage.php");
die();
}
if ($_POST['action'] == "add")
{
if ($_POST["linkname"] == "" || $_POST["url"] == "" || $_POST["title"] == "")
stderr($lang_linksmanage['std_error'], $lang_linksmanage['std_missing_form_data']);
$linkname = sqlesc($_POST["linkname"]);
$url = sqlesc($_POST["url"]);
$title = sqlesc($_POST["title"]);
sql_query("INSERT INTO links (name, url, title) VALUES($linkname, $url, $title)") or sqlerr(__FILE__, __LINE__);
$res = sql_query("SELECT id FROM links WHERE name=$linkname");
$Cache->delete_value('links');
$arr = mysql_fetch_row($res);
if (!$arr)
stderr($lang_linksmanage['std_error'], $lang_linksmanage['std_unable_creating_new_link']);
header("Location: linksmanage.php");
die;
}
stdhead($lang_linksmanage['std_links_manage']);
?>
<h1><?php echo $lang_linksmanage['text_add_link']?></h1>
<form method=post action="<?php echo $_SERVER["PHP_SELF"];?>">
<table border=1 cellspacing=0 cellpadding=5>
<tr><td class=rowhead><?php echo $lang_linksmanage['text_site_name']?></td><td><input type=text name=linkname style="width: 200px"></td></tr>
<tr><td class=rowhead><?php echo $lang_linksmanage['text_url']?></td><td><input type=text name=url style="width: 200px"></td></tr>
<tr><td class=rowhead><?php echo $lang_linksmanage['text_title']?></td><td><input type=text name=title style="width: 200px"></td></tr>
<tr><td colspan=2 align=center><input type="hidden" name="action" value="add"><input type=submit value="<?php echo $lang_linksmanage['submit_okay']?>" class=btn></td></tr>
</table>
</form>
<?php
echo '<h1>'.$lang_linksmanage['text_manage_links'].'</h1>';
echo '<table width="80%" border="0" align="center" cellpadding="2" cellspacing="0">';
echo "<tr><td class=colhead align=left>".$lang_linksmanage['text_site_name']."</td><td class=colhead>".$lang_linksmanage['text_url']."</td><td class=colhead>".$lang_linksmanage['text_title']."</td><td class=colhead align=center>".$lang_linksmanage['text_modify']."</td></tr>";
$result = sql_query ("SELECT * FROM links ORDER BY id ASC");
if ($row = mysql_fetch_array($result)) {
do {
echo "<tr><td>".$row["name"]."</td><td>".$row["url"]."</td><td>".$row["title"]. "</td><td align=center nowrap><b><a href=\"".$PHP_SELF."?action=edit&id=".$row["id"]."\">".$lang_linksmanage['text_edit']."</a>&nbsp;|&nbsp;<a href=\"javascript:confirm_delete('".$row["id"]."', '".$lang_linksmanage['js_sure_to_delete_link']."', '');\"><font color=red>".$lang_linksmanage['text_delete']."</font></a></b></td></tr>";
} while($row = mysql_fetch_array($result));
} else {print "<tr><td colspan=4>".$lang_linksmanage['text_no_links_found']."</td></tr>";}
echo "</table>";
?>
<?php if ($_GET['action'] == "edit") {
$id = intval($_GET["id"] ?? 0);
$result = sql_query ("SELECT * FROM links where id = ".sqlesc($id));
if ($row = mysql_fetch_array($result)) {
?>
<h1><?php echo $lang_linksmanage['text_edit_link']?></h1>
<form method=post action="<?php echo $_SERVER['PHP_SELF'];?>">
<table border=1 cellspacing=0 cellpadding=5>
<tr><td class=rowhead><?php echo $lang_linksmanage['text_site_name']?></td><td><input type=text name=linkname size=40 value="<?php echo $row['name'];?>"></td></tr>
<tr><td class=rowhead><?php echo $lang_linksmanage['text_url']?></td><td><input type=text name=url size=40 value="<?php echo $row["url"];?>"></td></tr>
<tr><td class=rowhead><?php echo $lang_linksmanage['text_title']?></td><td><input type=text name=title size=40 value="<?php echo $row["title"];?>"></td></tr>
<tr><td colspan=2 align=center><input type="hidden" name=id value="<?php echo $row["id"];?>"><input type="hidden" name="action" value="editlink"><input type=submit value="<?php echo $lang_linksmanage['submit_okay']?>" class=btn></td></tr>
</table>
</form>
<?php
}
}
stdfoot();
}
+247
View File
@@ -0,0 +1,247 @@
<?php
ob_start();
require_once("../include/bittorrent.php");
dbconn();
loggedinorreturn();
if (get_user_class() < UC_SYSOP) {
die("access denied.");
}
mysql_connect($mysql_host,$mysql_user,$mysql_pass, $BASIC['mysql_db'], $BASIC['mysql_port']);
mysql_select_db($mysql_db);
stdhead("Manage Locations");
begin_main_frame("",false,100);
begin_frame("Manage Locations",true,10,"100%","center");
$sure = $_GET['sure'] ?? '';
if($sure == "yes") {
$delid = $_GET['delid'];
$query = "DELETE FROM locations WHERE id=" .sqlesc($delid) . " LIMIT 1";
$sql = sql_query($query);
echo("Location successfuly removed, click <a class=altlink href=" . $_SERVER['PHP_SELF'] .">here</a> to go back.");
end_frame();
stdfoot();
die();
}
$delid = intval($_GET['delid'] ?? 0);
if($delid > 0) {
echo("Are you sure you would like to delete this Location?( <strong><a href='". $_SERVER['PHP_SELF'] . "?delid=$delid&sure=yes'>Yes!</a></strong> / <strong><a href='". $_SERVER['PHP_SELF'] . "'>No</a></strong> )");
end_frame();
stdfoot();
die();
}
$edited = intval($_GET['edited'] ?? 0);
if($edited == 1) {
$id = intval($_GET['id'] ?? 0);
$name = $_GET['name'];
$flagpic = $_GET['flagpic'];
$location_main = $_GET['location_main'];
$location_sub = $_GET['location_sub'];
$start_ip = $_GET['start_ip'];
$end_ip = $_GET['end_ip'];
$theory_upspeed = $_GET['theory_upspeed'];
$practical_upspeed = $_GET['practical_upspeed'];
$theory_downspeed = $_GET['theory_downspeed'];
$practical_downspeed = $_GET['practical_downspeed'];
if(validip_format($start_ip) && validip_format($end_ip))
{
if(ip2long($end_ip) > ip2long($start_ip))
{
$query = "UPDATE locations SET name = " . sqlesc($name) .",flagpic = " . sqlesc($flagpic) . ",location_main = " . sqlesc($location_main). ",location_sub= " . sqlesc($location_sub) . ",start_ip = " . sqlesc($start_ip) . ",end_ip = " . sqlesc($end_ip) . ",theory_upspeed = " . sqlesc($theory_upspeed) . ",practical_upspeed = " . sqlesc($practical_upspeed) . ",theory_downspeed = " . sqlesc($theory_downspeed) . ",practical_downspeed = " . sqlesc($practical_downspeed). " WHERE id=".sqlesc($id);
$sql = sql_query($query) or sqlerr(__FILE__, __LINE__);
if($sql)
{
stdmsg("Success!","Location has been edited, click <a class=altlink href=" . $_SERVER['PHP_SELF'] .">here</a> to go back");
stdfoot();
die();
}
}
else
echo("<p><strong>The end IP address should be larger than the start one, or equal for single IP check!</strong></p>");
}
else
echo("<p><strong>Invalid IP Address Format !!! </strong></p>");
}
$editid = $_GET['editid'] ?? 0;
if($editid > 0) {
$query = "SELECT * FROM locations WHERE id=" . sqlesc($editid);
$sql = sql_query($query);
$row = mysql_fetch_array($sql);
$name = $row['name'];
$flagpic = $row['flagpic'];
$location_main = $row['location_main'];
$location_sub = $row['location_sub'];
$start_ip = $row['start_ip'];
$end_ip = $row['end_ip'];
$theory_upspeed = $row['theory_upspeed'];
$practical_upspeed = $row['practical_upspeed'];
$theory_downspeed = $row['theory_downspeed'];
$practical_downspeed = $row['practical_downspeed'];
echo("<form name='form1' method='get' action='" . $_SERVER['PHP_SELF'] . "'>");
echo("<input type='hidden' name='id' value='$editid'><table class=main cellspacing=0 cellpadding=5 width=50%>");
echo("<tr><td class=colhead align=center colspan=2>Editing Locations</td><input type='hidden' name='edited' value='1'></tr>");
echo("<tr><td class=rowhead>Name:</td><td class=rowfollow align=left><input type='text' size=10 name='name' value='$name'></td></tr>");
echo("<tr><td class=rowhead><nobr>Main Location:</nobr></td><td class=rowfollow align=left><input type='text' size=50 name='location_main' value='$location_main'></td></tr>");
echo("<tr><td class=rowhead><nobr>Sub Location:</nobr></td><td class=rowfollow align=left><input type='text' size=50 name='location_sub' value='$location_sub'></td></tr>");
echo("<tr><td class=rowhead><nobr>Start IP:</nobr></td><td class=rowfollow align=left><input type='text' size=30 name='start_ip' value='" . $start_ip . "'></td></tr>");
echo("<tr><td class=rowhead><nobr>End IP:</nobr></td><td class=rowfollow align=left><input type='text' size=30 name='end_ip' value='" . $end_ip. "'></td></tr>");
echo("<tr><td class=rowhead><nobr>Theory Up:</nobr></td><td class=rowfollow align=left><input type='text' size=10 name='theory_upspeed' value='$theory_upspeed'></td></tr>");
echo("<tr><td class=rowhead><nobr>Theory Down:</nobr></td><td class=rowfollow align=left><input type='text' size=10 name='theory_downspeed' value='$theory_downspeed'></td></tr>");
echo("<tr><td class=rowhead><nobr>Practical Up:</nobr></td><td class=rowfollow align=left><input type='text' size=10 name='practical_upspeed' value='$practical_upspeed'></td></tr>");
echo("<tr><td class=rowhead><nobr>Practical Down:</nobr></td><td class=rowfollow align=left><input type='text' size=10 name='practical_downspeed' value='$practical_downspeed'></td></tr>");
echo("<tr><td class=rowhead>Picture:</td><td class=rowfollow align=left><input type='text' size=50 name='flagpic' value='$flagpic'></td></tr>");
echo("<tr><td class=toolbox align=center colspan=2><input class=btn type='Submit'></td></tr>");
echo("</table></form>");
end_frame();
stdfoot();
die();
}
$add = $_GET['add'] ?? '';
$success = false;
if($add == 'true') {
$name = $_GET['name'];
$flagpic = $_GET['flagpic'];
$location_main = $_GET['location_main'];
$location_sub = $_GET['location_sub'];
$start_ip = $_GET['start_ip'];
$end_ip = $_GET['end_ip'];
$theory_upspeed = $_GET['theory_upspeed'];
$practical_upspeed = $_GET['practical_upspeed'];
$theory_downspeed = $_GET['theory_downspeed'];
$practical_downspeed = $_GET['practical_downspeed'];
if(validip_format($start_ip) && validip_format($end_ip))
{
if(ip2long($end_ip) > ip2long($start_ip))
{
$query = "INSERT INTO locations (name, flagpic, location_main, location_sub, start_ip, end_ip, theory_upspeed, practical_upspeed, theory_downspeed, practical_downspeed) VALUES (" . sqlesc($name) ."," . sqlesc($flagpic) . "," . sqlesc($location_main). "," . sqlesc($location_sub) . "," . sqlesc($start_ip) . "," . sqlesc($end_ip) . "," . sqlesc($theory_upspeed) . "," . sqlesc($practical_upspeed) . "," . sqlesc($theory_downspeed) . "," . sqlesc($practical_downspeed) . ")";
$sql = sql_query($query) or sqlerr(__FILE__, __LINE__);
if($sql) {
$success = true;
} else {
$success = false;
}
}
else
echo("<p><strong>The end IP address should be larger than the start one, or equal for single IP check!</strong></p>");
}
else
echo("<p><strong>Invalid IP Address Format !!! </strong></p>");
}
echo("<form name='form1' method='get' action='" . $_SERVER['PHP_SELF'] . "'>");
echo("<table class=main cellspacing=0 cellpadding=5 width=48% align= left>");
echo("<tr><td class=colhead align=center colspan=2>Add New Locations</td></tr>");
echo("<tr><td class=rowhead>Name:</td><td class=rowfollow align=left><input type='text' size=10 name='name'></td></tr>");
echo("<tr><td class=rowhead><nobr>Main Location:</nobr></td><td class=rowfollow align=left><input type='text' size=50 name='location_main'></td></tr>");
echo("<tr><td class=rowhead><nobr>Sub Location:</nobr></td><td class=rowfollow align=left><input type='text' size=50 name='location_sub'></td></tr>");
echo("<tr><td class=rowhead><nobr>Start IP:</nobr></td><td class=rowfollow align=left><input type='text' size=30 name='start_ip'></td></tr>");
echo("<tr><td class=rowhead><nobr>End IP:</nobr></td><td class=rowfollow align=left><input type='text' size=30 name='end_ip'></td></tr>");
echo("<tr><td class=rowhead><nobr>Theory Up:</nobr></td><td class=rowfollow align=left><input type='text' size=10 name='theory_upspeed'></td></tr>");
echo("<tr><td class=rowhead><nobr>Theory Down:</nobr></td><td class=rowfollow align=left><input type='text' size=10 name='theory_downspeed'></td></tr>");
echo("<tr><td class=rowhead><nobr>Practical Up:</nobr></td><td class=rowfollow align=left><input type='text' size=10 name='practical_upspeed'></td></tr>");
echo("<tr><td class=rowhead><nobr>Practical Down:</nobr></td><td class=rowfollow align=left><input type='text' size=10 name='practical_downspeed'></td></tr>");
echo("<tr><td class=rowhead>Picture:</td><td class=rowfollow align=left><input type='text' size=50 name='flagpic'><input type='hidden' name='add' value='true'></td></tr>");
echo("<tr><td class=toolbox align=center colspan=2><input class=btn type='Submit'></td></tr>");
echo("</table>");
echo("</form>");
$range_start_ip = $_GET['range_start_ip'] ?? '';
$range_end_ip = $_GET['range_end_ip'] ?? '';
echo("<form name='form2' method='get' action='" . $_SERVER['PHP_SELF'] . "'>");
echo("<table class=main cellspacing=0 cellpadding=5 width=48% align=right>");
echo("<tr><td class=colhead align=center colspan=2>Check IP Range</td></tr>");
echo("<tr><td class=rowhead><nobr>Start IP:</nobr></td><td class=rowfollow align=left><input type='text' size=30 name='range_start_ip' value='" . $range_start_ip . "'></td></tr>");
echo("<tr><td class=rowhead><nobr>End IP:</nobr></td><td class=rowfollow align=left><input type='text' size=30 name='range_end_ip' value='" . $range_end_ip . "'><input type='hidden' name='check_range' value='true'></td></tr>");
echo("<tr><td class=toolbox align=center colspan=2><input class=btn type='Submit'></td></tr>");
echo("</table>");
echo("</form>");
///////////////////// E X I S T I N G C A T E G O R I E S \\\\\\\\\\\\\\\\\\\\\\\\\\\\
print("<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />");
unset($wherea);
$wherea = '';
$check_range = $_GET['check_range'] ?? '';
if($check_range == 'true') {
//stderr("",$range_start_ip . $range_end_ip . validip_format($range_start_ip) . validip_format($range_end_ip));
if(validip_format($range_start_ip) && validip_format($range_end_ip))
{
if(ip2long($range_end_ip) > ip2long($range_start_ip))
{
$wherea = "WHERE INET_ATON(start_ip) <=" . ip2long($range_start_ip) . " AND INET_ATON(end_ip) >=" . ip2long($range_end_ip);
echo("<p><strong>Conforming Locations:</strong></p>");
}
else
echo("<p><strong>The end IP address should be larger than the start one, or equal for single IP check!</strong></p>");
}
else
echo("<p><strong>Invalid IP Address Format !!! </strong></p>");
}
else
{
echo("<p><strong>" . ($success == true ? "(Updated!)" : "") . "Existing Locations:</strong></p>");
}
echo("<table class=main cellspacing=0 cellpadding=5>");
echo("<td class=colhead align=center><b>ID</b></td> <td class=colhead align=left><b>Name</b></td> <td class=colhead align=center><b>Pic</b></td> <td class=colhead align=center><b><nobr>Main Location</nobr></b></td> <td class=colhead align=center><b><nobr>Sub Location</nobr></b></td> <td class=colhead align=center><b>Start IP</b></td> <td class=colhead align=center><b>End IP</b></td> <td class=colhead align=center><b>T.U</b></td> <td class=colhead align=center><b>P.U</b></td> <td class=colhead align=center><b>T.D</b></td> <td class=colhead align=center><b>P.D</b></td> <td class=colhead align=center><b>Edit</b></td><td class=colhead align=center><b>Delete</b></td>");
$res = sql_query("SELECT COUNT(*) FROM locations ".$wherea);
$row = mysql_fetch_array($res);
$count = $row[0];
$perpage = 50;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "location.php?");
$query = "SELECT * FROM locations " . $wherea ." ORDER BY name ASC, start_ip ASC ".$limit;
$sql = sql_query($query);
$maxlen_sub_location = 40;
while ($row = mysql_fetch_array($sql)) {
$id = $row['id'];
$name = $row['name'];
$flagpic = $row['flagpic'];
$location_main = $row['location_main'];
$location_sub = $row['location_sub'];
$start_ip = $row['start_ip'];
$end_ip = $row['end_ip'];
$theory_upspeed = $row['theory_upspeed'];
$practical_upspeed = $row['practical_upspeed'];
$theory_downspeed = $row['theory_downspeed'];
$practical_downspeed = $row['practical_downspeed'];
$count_location_sub=strlen($location_sub);
if($count_location_sub > $maxlen_sub_location)
$location_sub=substr($location_sub, 0, $maxlen_sub_location) . "..";
echo("<tr><td class=rowfollow align=center><strong>$id</strong></td>" .
"<td class=rowfollow align=left><strong>$name</strong></td>" .
"<td class=rowfollow align=center>" . ($flagpic != "" ? "<img src='" . get_protocol_prefix() . "$BASEURL/pic/location/$flagpic' border='0' />" : "-") . "</td>" .
"<td class=rowfollow align=left>$location_main</td>" .
"<td class=rowfollow align=left>$location_sub</td>" .
"<td class=rowfollow align=left>" . $start_ip . "</td>" .
"<td class=rowfollow align=left>" . $end_ip . "</td>" .
"<td class=rowfollow align=left>$theory_upspeed</td>" .
"<td class=rowfollow align=left>$practical_upspeed</td>" .
"<td class=rowfollow align=left>$theory_downspeed</td>" .
"<td class=rowfollow align=left>$practical_downspeed</td>" .
"<td class=rowfollow align=center><a href='" . $_SERVER['PHP_SELF'] . "?editid=$id'>Edit</a></td>".
"<td class=rowfollow align=center><a href='" . $_SERVER['PHP_SELF'] . "?delid=$id'>Remove</a></td>" .
"</tr>");
}
print("</table>");
echo $pagerbottom;
end_frame();
end_frame();
stdfoot();
?>
+434
View File
@@ -0,0 +1,434 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
if (get_user_class() < $log_class)
{
stderr($lang_log['std_sorry'],$lang_log['std_permission_denied_only'].get_user_class_name($log_class,false,true,true).$lang_log['std_or_above_can_view'],false);
}
function permissiondeny(){
global $lang_log;
stderr($lang_log['std_sorry'],$lang_log['std_permission_denied'],false);
}
function logmenu($selected = "dailylog"){
global $lang_log;
global $showfunbox_main;
begin_main_frame();
print ("<div id=\"lognav\"><ul id=\"logmenu\" class=\"menu\">");
print ("<li" . ($selected == "dailylog" ? " class=selected" : "") . "><a href=\"?action=dailylog\">".$lang_log['text_daily_log']."</a></li>");
print ("<li" . ($selected == "chronicle" ? " class=selected" : "") . "><a href=\"?action=chronicle\">".$lang_log['text_chronicle']."</a></li>");
if ($showfunbox_main == 'yes')
print ("<li" . ($selected == "funbox" ? " class=selected" : "") . "><a href=\"?action=funbox\">".$lang_log['text_funbox']."</a></li>");
print ("<li" . ($selected == "news" ? " class=selected" : "") . "><a href=\"?action=news\">".$lang_log['text_news']."</a></li>");
print ("<li" . ($selected == "poll" ? " class=selected" : "") . "><a href=\"?action=poll\">".$lang_log['text_poll']."</a></li>");
print ("</ul></div>");
end_main_frame();
}
function searchtable($title, $action, $opts = array()){
global $lang_log;
print("<table border=1 cellspacing=0 width=940 cellpadding=5>\n");
print("<tr><td class=colhead align=left>".$title."</td></tr>\n");
print("<tr><td class=toolbox align=left><form method=\"get\" action='" . $_SERVER['PHP_SELF'] . "'>\n");
print("<input type=\"text\" name=\"query\" style=\"width:500px\" value=\"".($_GET['query'] ?? '')."\">\n");
if ($opts) {
print($lang_log['text_in']."<select name=search>");
foreach($opts as $value => $text)
print("<option value='".$value."'". ($value == $_GET['search'] ? " selected" : "").">".$text."</option>");
print("</select>");
}
print("<input type=\"hidden\" name=\"action\" value='".$action."'>&nbsp;&nbsp;");
print("<input type=submit value=" . $lang_log['submit_search'] . "></form>\n");
print("</td></tr></table><br />\n");
}
function additem($title, $action){
global $lang_log;
print("<table border=1 cellspacing=0 width=940 cellpadding=5>\n");
print("<tr><td class=colhead align=left>".$title."</td></tr>\n");
print("<tr><td class=toolbox align=left><form method=\"post\" action='" . $_SERVER['PHP_SELF'] . "'>\n");
print("<textarea name=\"txt\" style=\"width:500px\" rows=\"3\" >".$title."</textarea>\n");
print("<input type=\"hidden\" name=\"action\" value=".$action.">");
print("<input type=\"hidden\" name=\"do\" value=\"add\">");
print("<input type=submit value=" . $lang_log['submit_add'] . "></form>\n");
print("</td></tr></table><br />\n");
}
function edititem($title, $action, $id){
global $lang_log;
$result = sql_query ("SELECT * FROM ".$action." where id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
if ($row = mysql_fetch_array($result)) {
print("<table border=1 cellspacing=0 width=940 cellpadding=5>\n");
print("<tr><td class=colhead align=left>".$title."</td></tr>\n");
print("<tr><td class=toolbox align=left><form method=\"post\" action='" . $_SERVER['PHP_SELF'] . "'>\n");
print("<textarea name=\"txt\" style=\"width:500px\" rows=\"3\" >".$row["txt"]."</textarea>\n");
print("<input type=\"hidden\" name=\"action\" value=".$action.">");
print("<input type=\"hidden\" name=\"do\" value=\"update\">");
print("<input type=\"hidden\" name=\"id\" value=".$id.">");
print("<input type=submit value=" . $lang_log['submit_okay'] . " style='height: 20px' /></form>\n");
print("</td></tr></table><br />\n");
}
}
$action = isset($_POST['action']) ? htmlspecialchars($_POST['action']) : (isset($_GET['action']) ? htmlspecialchars($_GET['action']) : '');
$allowed_actions = array("dailylog","chronicle","funbox","news","poll");
if (!$action)
$action='dailylog';
if (!in_array($action, $allowed_actions))
stderr($lang_log['std_error'], $lang_log['std_invalid_action']);
else {
switch ($action){
case "dailylog":
stdhead($lang_log['head_site_log']);
$query = mysql_real_escape_string(trim($_GET["query"] ?? ''));
$search = $_GET["search"] ?? '';
$addparam = "";
$wherea = "";
if (get_user_class() >= $confilog_class){
switch ($search)
{
case "mod": $wherea=" WHERE security_level = 'mod'"; break;
case "normal": $wherea=" WHERE security_level = 'normal'"; break;
case "all": break;
}
$addparam = ($wherea ? "search=".rawurlencode($search)."&" : "");
}
else{
$wherea=" WHERE security_level = 'normal'";
}
if($query){
$wherea .= ($wherea ? " AND " : " WHERE ")." txt LIKE '%$query%' ";
$addparam .= "query=".rawurlencode($query)."&";
}
logmenu('dailylog');
$opt = array ('all' => $lang_log['text_all'], 'normal' => $lang_log['text_normal'], 'mod' => $lang_log['text_mod']);
searchtable($lang_log['text_search_log'], 'dailylog',$opt);
$res = sql_query("SELECT COUNT(*) FROM sitelog".$wherea);
$row = mysql_fetch_array($res);
$count = $row[0];
$perpage = 50;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "log.php?action=dailylog&".$addparam);
$res = sql_query("SELECT added, txt FROM sitelog $wherea ORDER BY added DESC $limit") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print($lang_log['text_log_empty']);
else
{
//echo $pagertop;
print("<table width=940 border=1 cellspacing=0 cellpadding=5>\n");
print("<tr><td class=colhead align=center><img class=\"time\" src=\"pic/trans.gif\" alt=\"time\" title=\"".$lang_log['title_time_added']."\" /></td><td class=colhead align=left>".$lang_log['col_event']."</td></tr>\n");
while ($arr = mysql_fetch_assoc($res))
{
$color = "";
if (strpos($arr['txt'],'was uploaded by')) $color = "green";
if (strpos($arr['txt'],'was deleted by')) $color = "red";
if (strpos($arr['txt'],'was added to the Request section')) $color = "purple";
if (strpos($arr['txt'],'was edited by')) $color = "blue";
if (strpos($arr['txt'],'settings updated by')) $color = "darkred";
print("<tr><td class=\"rowfollow nowrap\" align=center>".gettime($arr['added'],true,false)."</td><td class=rowfollow align=left><font color='".$color."'>".htmlspecialchars($arr['txt'])."</font></td></tr>\n");
}
print("</table>");
echo $pagerbottom;
}
print($lang_log['time_zone_note']);
stdfoot();
die;
break;
case "chronicle":
stdhead($lang_log['head_chronicle']);
$query = mysql_real_escape_string(trim($_GET["query"] ?? ''));
if($query){
$wherea=" WHERE txt LIKE '%$query%' ";
$addparam = "query=".rawurlencode($query)."&";
}
else{
$wherea="";
$addparam = "";
}
logmenu("chronicle");
searchtable($lang_log['text_search_chronicle'], 'chronicle');
if (get_user_class() >= $chrmanage_class)
additem($lang_log['text_add_chronicle'], 'chronicle');
if (
(isset($_GET['do']) && $_GET['do'] == "del")
|| (isset($_GET['do'] ) && $_GET['do'] == 'edit')
|| (isset($_POST['do']) && $_POST['do'] == "add")
|| (isset($_POST['do']) && $_POST['do'] == "update")
)
{
$txt = $_POST['txt'] ?? '';
if (get_user_class() < $chrmanage_class)
permissiondeny();
elseif (isset($_POST['do']) && $_POST['do'] == "add")
sql_query ("INSERT INTO chronicle (userid,added, txt) VALUES ('".$CURUSER["id"]."', now(), ".sqlesc($txt).")") or sqlerr(__FILE__, __LINE__);
elseif (isset($_POST['do'] ) && $_POST['do'] == "update"){
$id = intval($_POST['id'] ?? 0);
if (!$id) { header("Location: log.php?action=chronicle"); die();}
else sql_query ("UPDATE chronicle SET txt=".sqlesc($txt)." WHERE id=".$id) or sqlerr(__FILE__, __LINE__);}
else {$id = (intval($_GET['id'] ?? 0));
if (!$id) { header("Location: log.php?action=chronicle"); die();}
elseif ($_GET['do'] == "del")
sql_query ("DELETE FROM chronicle where id = '".$id."'") or sqlerr(__FILE__, __LINE__);
elseif (isset($_GET['do']) && $_GET['do'] == "edit")
edititem($lang_log['text_edit_chronicle'],'chronicle', $id);
}
}
$res = sql_query("SELECT COUNT(*) FROM chronicle".$wherea);
$row = mysql_fetch_array($res);
$count = $row[0];
$perpage = 50;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "log.php?action=chronicle&".$addparam);
$res = sql_query("SELECT id, added, txt FROM chronicle $wherea ORDER BY added DESC $limit") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print($lang_log['text_chronicle_empty']);
else
{
//echo $pagertop;
print("<table width=940 border=1 cellspacing=0 cellpadding=5>\n");
print("<tr><td class=colhead align=center>".$lang_log['col_date']."</td><td class=colhead align=left>".$lang_log['col_event']."</td>".(get_user_class() >= $chrmanage_class ? "<td class=colhead align=center>".$lang_log['col_modify']."</td>" : "")."</tr>\n");
while ($arr = mysql_fetch_assoc($res))
{
$date = gettime($arr['added'],true,false);
print("<tr><td class=rowfollow align=center><nobr>$date</nobr></td><td class=rowfollow align=left>".format_comment($arr["txt"],true,false,true)."</td>".(get_user_class() >= $chrmanage_class ? "<td align=center nowrap><b><a href=\"".$_SERVER['PHP_SELF']."?action=chronicle&do=edit&id=".$arr["id"]."\">".$lang_log['text_edit']."</a>&nbsp;|&nbsp;<a href=\"".$_SERVER['PHP_SELF']."?action=chronicle&do=del&id=".$arr["id"]."\"><font color=red>".$lang_log['text_delete']."</font></a></b></td>" : "")."</tr>\n");
}
print("</table>");
echo $pagerbottom;
}
print($lang_log['time_zone_note']);
stdfoot();
die;
break;
case "funbox":
stdhead($lang_log['head_funbox']);
$query = mysql_real_escape_string(trim($_GET["query"]));
$search = $_GET["search"];
if($query){
switch ($search){
case "title": $wherea=" WHERE title LIKE '%$query%' AND status != 'banned'"; break;
case "body": $wherea=" WHERE body LIKE '%$query%' AND status != 'banned'"; break;
case "both": $wherea=" WHERE (body LIKE '%$query%' or title LIKE '%$query%') AND status != 'banned'" ; break;
}
$addparam = "search=".rawurlencode($search)."&query=".rawurlencode($query)."&";
}
else{
$wherea=" WHERE status != 'banned'";
$addparam = "";
}
logmenu("funbox");
$opt = array (title => $lang_log['text_title'], body => $lang_log['text_body'], both => $lang_log['text_both']);
searchtable($lang_log['text_search_funbox'], 'funbox', $opt);
$res = sql_query("SELECT COUNT(*) FROM fun ".$wherea);
$row = mysql_fetch_array($res);
$count = $row[0];
$perpage = 10;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "log.php?action=funbox&".$addparam);
$res = sql_query("SELECT added, body, title, status FROM fun $wherea ORDER BY added DESC $limit") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print($lang_log['text_funbox_empty']);
else
{
//echo $pagertop;
while ($arr = mysql_fetch_assoc($res)){
$date = gettime($arr['added'],true,false);
print("<table width=940 border=1 cellspacing=0 cellpadding=5>\n");
print("<tr><td class=rowhead width='10%'>".$lang_log['col_title']."</td><td class=rowfollow align=left>".$arr["title"]." - <b>".$arr["status"]."</b></td></tr><tr><td class=rowhead width='10%'>".$lang_log['col_date']."</td><td class=rowfollow align=left>".$date."</td></tr><tr><td class=rowhead width='10%'>".$lang_log['col_body']."</td><td class=rowfollow align=left>".format_comment($arr["body"],false,false,true)."</td></tr>\n");
print("</table><br />");
}
echo $pagerbottom;
}
print($lang_log['time_zone_note']);
stdfoot();
die;
break;
case "news":
stdhead($lang_log['head_news']);
$query = mysql_real_escape_string(trim($_GET["query"] ?? ''));
$search = $_GET["search"] ?? '';
if($query){
switch ($search){
case "title": $wherea=" WHERE title LIKE '%$query%' "; break;
case "body": $wherea=" WHERE body LIKE '%$query%' "; break;
case "both": $wherea=" WHERE body LIKE '%$query%' or title LIKE '%$query%'" ; break;
}
$addparam = "search=".rawurlencode($search)."&query=".rawurlencode($query)."&";
}
else{
$wherea= "";
$addparam = "";
}
logmenu("news");
$opt = array ('title' => $lang_log['text_title'], 'body' => $lang_log['text_body'], 'both' => $lang_log['text_both']);
searchtable($lang_log['text_search_news'], 'news', $opt);
$res = sql_query("SELECT COUNT(*) FROM news".$wherea);
$row = mysql_fetch_array($res);
$count = $row[0];
$perpage = 20;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "log.php?action=news&".$addparam);
$res = sql_query("SELECT id, added, body, title FROM news $wherea ORDER BY added DESC $limit") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print($lang_log['text_news_empty']);
else
{
//echo $pagertop;
while ($arr = mysql_fetch_assoc($res)){
$date = gettime($arr['added'],true,false);
print("<table width=940 border=1 cellspacing=0 cellpadding=5>\n");
print("<tr><td class=rowhead width='10%'>".$lang_log['col_title']."</td><td class=rowfollow align=left>".$arr["title"]."</td></tr><tr><td class=rowhead width='10%'>".$lang_log['col_date']."</td><td class=rowfollow align=left>".$date."</td></tr><tr><td class=rowhead width='10%'>".$lang_log['col_body']."</td><td class=rowfollow align=left>".format_comment($arr["body"],false,false,true)."</td></tr>\n");
print("</table><br />");
}
echo $pagerbottom;
}
print($lang_log['time_zone_note']);
stdfoot();
die;
break;
case "poll":
$do = $_GET["do"] ?? '';
$pollid = intval($_GET["pollid"] ?? 0);
$returnto = htmlspecialchars($_GET["returnto"] ?? '');
if ($do == "delete")
{
if (get_user_class() < $chrmanage_class)
stderr($lang_log['std_error'], $lang_log['std_permission_denied']);
int_check($pollid,true);
$sure = $_GET["sure"];
if (!$sure)
stderr($lang_log['std_delete_poll'],$lang_log['std_delete_poll_confirmation'] .
"<a href=?action=poll&do=delete&pollid=$pollid&returnto=$returnto&sure=1>".$lang_log['std_here_if_sure'],false);
sql_query("DELETE FROM pollanswers WHERE pollid = $pollid") or sqlerr();
sql_query("DELETE FROM polls WHERE id = $pollid") or sqlerr();
$Cache->delete_value('current_poll_content');
$Cache->delete_value('current_poll_result', true);
if ($returnto == "main")
header("Location: " . get_protocol_prefix() . "$BASEURL");
else
header("Location: " . get_protocol_prefix() . "$BASEURL/log.php?action=poll&deleted=1");
die;
}
$rows = sql_query("SELECT COUNT(*) FROM polls") or sqlerr();
$row = mysql_fetch_row($rows);
$pollcount = $row[0];
if ($pollcount == 0)
stderr($lang_log['std_sorry'], $lang_log['std_no_polls']);
$polls = sql_query("SELECT * FROM polls ORDER BY id DESC LIMIT 1," . ($pollcount - 1 )) or sqlerr();
stdhead($lang_log['head_previous_polls']);
logmenu("poll");
print("<table border=1 cellspacing=0 width=940 cellpadding=5>\n");
//print("<tr><td class=colhead align=center>".$lang_log['text_previous_polls']."</td></tr>\n");
function srt($a,$b)
{
if ($a[0] > $b[0]) return -1;
if ($a[0] < $b[0]) return 1;
return 0;
}
while ($poll = mysql_fetch_assoc($polls))
{
$o = array($poll["option0"], $poll["option1"], $poll["option2"], $poll["option3"], $poll["option4"],
$poll["option5"], $poll["option6"], $poll["option7"], $poll["option8"], $poll["option9"],
$poll["option10"], $poll["option11"], $poll["option12"], $poll["option13"], $poll["option14"],
$poll["option15"], $poll["option16"], $poll["option17"], $poll["option18"], $poll["option19"]);
print("<tr><td align=center>\n");
print("<p class=sub>");
$added = gettime($poll['added'], true, false);
print($added);
if (get_user_class() >= $pollmanage_class)
{
print(" - [<a href=makepoll.php?action=edit&pollid=$poll[id]><b>".$lang_log['text_edit']."</b></a>]\n");
print(" - [<a href=?action=poll&do=delete&pollid=$poll[id]><b>".$lang_log['text_delete']."</b></a>]\n");
}
print("<a name=$poll[id]>");
print("</p>\n");
print("<table class=main border=1 cellspacing=0 cellpadding=5><tr><td class=text>\n");
print("<p align=center><b>" . $poll["question"] . "</b></p>");
$pollanswers = sql_query("SELECT selection FROM pollanswers WHERE pollid=" . $poll["id"] . " AND selection < 20") or sqlerr();
$tvotes = mysql_num_rows($pollanswers);
$vs = array(); // count for each option ([0]..[19])
$os = array(); // votes and options: array(array(123, "Option 1"), array(45, "Option 2"))
// Count votes
while ($pollanswer = mysql_fetch_row($pollanswers))
$vs[$pollanswer[0]] += 1;
reset($o);
for ($i = 0; $i < count($o); ++$i)
if (isset($o[$i]) && isset($vs[$i]))
$os[$i] = array($vs[$i], $o[$i]);
print("<table width=100% class=main border=0 cellspacing=0 cellpadding=0>\n");
$i = 0;
while (isset($os[$i]))
{
$a = $os[$i];
if ($tvotes > 0)
$p = round($a[0] / $tvotes * 100);
else
$p = 0;
print("<tr><td class=embedded>" . $a[1] . "&nbsp;&nbsp;</td><td class=\"embedded nowrap\">" .
"<img class=\"bar_end\" src=\"pic/trans.gif\" alt=\"\" /><img class=\"unsltbar\" src=\"pic/trans.gif\" style=\"width: " . ($p * 3) . "px\" /><img class=\"bar_end\" src=\"pic/trans.gif\" alt=\"\" /> $p%</td></tr>\n");
++$i;
}
print("</table>\n");
$tvotes = number_format($tvotes);
print("<p align=center>".$lang_log['text_votes']."$tvotes</p>\n");
print("</td></tr></table><br /><br />\n");
print("</p></td></tr>\n");
}
print("</table>");
print($lang_log['time_zone_note']);
stdfoot();
die;
break;
}
}
?>
+103
View File
@@ -0,0 +1,103 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
$langid = intval($_GET['sitelanguage'] ?? 0);
if ($langid)
{
$lang_folder = validlang($langid);
if(get_langfolder_cookie() != $lang_folder)
{
set_langfolder_cookie($lang_folder);
header("Location: " . $_SERVER['PHP_SELF']);
}
}
require_once(get_langfile_path("", false, $CURLANGDIR));
failedloginscheck ();
cur_user_check () ;
stdhead($lang_login['head_login']);
$s = "<select name=\"sitelanguage\" onchange='submit()'>\n";
$langs = langlist("site_lang");
foreach ($langs as $row)
{
if ($row["site_lang_folder"] == get_langfolder_cookie()) $se = "selected=\"selected\""; else $se = "";
$s .= "<option value=\"". $row["id"] ."\" ". $se. ">" . htmlspecialchars($row["lang_name"]) . "</option>\n";
}
$s .= "\n</select>";
?>
<form method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<?php
print("<div align=\"right\">".$lang_login['text_select_lang']. $s . "</div>");
?>
</form>
<?php
unset($returnto);
if (!empty($_GET["returnto"])) {
$returnto = $_GET["returnto"];
if (!$_GET["nowarn"]) {
print("<h1>" . $lang_login['h1_not_logged_in']. "</h1>\n");
print("<p><b>" . $lang_login['p_error']. "</b> " . $lang_login['p_after_logged_in']. "</p>\n");
}
}
?>
<form method="post" action="takelogin.php">
<p><?php echo $lang_login['p_need_cookies_enables']?><br /> [<b><?php echo $maxloginattempts;?></b>] <?php echo $lang_login['p_fail_ban']?></p>
<p><?php echo $lang_login['p_you_have']?> <b><?php echo remaining ();?></b> <?php echo $lang_login['p_remaining_tries']?></p>
<table border="0" cellpadding="5">
<tr><td class="rowhead"><?php echo $lang_login['rowhead_username']?></td><td class="rowfollow" align="left"><input type="text" name="username" style="width: 180px; border: 1px solid gray" /></td></tr>
<tr><td class="rowhead"><?php echo $lang_login['rowhead_password']?></td><td class="rowfollow" align="left"><input type="password" name="password" style="width: 180px; border: 1px solid gray"/></td></tr>
<?php
show_image_code ();
if ($securelogin == "yes")
$sec = "checked=\"checked\" disabled=\"disabled\"";
elseif ($securelogin == "no")
$sec = "disabled=\"disabled\"";
elseif ($securelogin == "op")
$sec = "";
if ($securetracker == "yes")
$sectra = "checked=\"checked\" disabled=\"disabled\"";
elseif ($securetracker == "no")
$sectra = "disabled=\"disabled\"";
elseif ($securetracker == "op")
$sectra = "";
?>
<tr><td class="toolbox" colspan="2" align="left"><?php echo $lang_login['text_advanced_options']?></td></tr>
<tr><td class="rowhead"><?php echo $lang_login['text_auto_logout']?></td><td class="rowfollow" align="left"><input class="checkbox" type="checkbox" name="logout" value="yes" /><?php echo $lang_login['checkbox_auto_logout']?></td></tr>
<tr><td class="rowhead"><?php echo $lang_login['text_restrict_ip']?></td><td class="rowfollow" align="left"><input class="checkbox" type="checkbox" name="securelogin" value="yes" /><?php echo $lang_login['checkbox_restrict_ip']?></td></tr>
<tr><td class="rowhead"><?php echo $lang_login['text_ssl']?></td><td class="rowfollow" align="left"><input class="checkbox" type="checkbox" name="ssl" value="yes" <?php echo $sec?> /><?php echo $lang_login['checkbox_ssl']?><br /><input class="checkbox" type="checkbox" name="trackerssl" value="yes" <?php echo $sectra?> /><?php echo $lang_login['checkbox_ssl_tracker']?></td></tr>
<tr><td class="toolbox" colspan="2" align="right"><input type="submit" value="<?php echo $lang_login['button_login']?>" class="btn" /> <input type="reset" value="<?php echo $lang_login['button_reset']?>" class="btn" /></td></tr>
</table>
<?php
if (isset($returnto))
print("<input type=\"hidden\" name=\"returnto\" value=\"" . htmlspecialchars($returnto) . "\" />\n");
?>
</form>
<p><?php echo $lang_login['p_no_account_signup']?></p>
<?php
if ($smtptype != 'none'){
?>
<p><?php echo $lang_login['p_forget_pass_recover']?></p>
<p><?php echo $lang_login['p_resend_confirm']?></p>
<?php
}
if ($showhelpbox_main != 'no'){?>
<table width="700" class="main" border="0" cellspacing="0" cellpadding="0"><tr><td class="embedded">
<h2><?php echo $lang_login['text_helpbox'] ?><font class="small"> - <?php echo $lang_login['text_helpbox_note'] ?><font id= "waittime" color="red"></font></h2>
<?php
print("<table width='100%' border='1' cellspacing='0' cellpadding='1'><tr><td class=\"text\">\n");
print("<iframe src='" . get_protocol_prefix() . $BASEURL . "/shoutbox.php?type=helpbox' width='650' height='180' frameborder='0' name='sbox' marginwidth='0' marginheight='0'></iframe><br /><br />\n");
print("<form action='" . get_protocol_prefix() . $BASEURL . "/shoutbox.php' id='helpbox' method='get' target='sbox' name='shbox'>\n");
print($lang_login['text_message']."<input type='text' id=\"hbtext\" name='shbox_text' autocomplete='off' style='width: 500px; border: 1px solid gray' ><input type='submit' id='hbsubmit' class='btn' name='shout' value=\"".$lang_login['sumbit_shout']."\" /><input type='reset' class='btn' value=".$lang_login['submit_clear']." /> <input type='hidden' name='sent' value='yes'><input type='hidden' name='type' value='helpbox' />\n");
print("<div id=sbword style=\"display: none\">".$lang_login['sumbit_shout']."</div>");
print(smile_row("shbox","shbox_text"));
print("</td></tr></table></form></td></tr></table>");
}
stdfoot();
+8
View File
@@ -0,0 +1,8 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
logoutcookie();
//logoutsession();
//header("Refresh: 0; url=./");
Header("Location: " . get_protocol_prefix() . "$BASEURL/");
?>
+38
View File
@@ -0,0 +1,38 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
if (get_user_class() < UC_SYSOP)
permissiondenied();
$action = isset($_POST['action']) ? htmlspecialchars($_POST['action']) : '';
if ($action == "sendmail")
{
$email = htmlspecialchars(trim($_POST['email']));
$email = safe_email($email);
if (!check_email($email))
stderr($lang_mailtest['std_error'], $lang_mailtest['std_invalid_email_address']);
$title = $SITENAME.$lang_mailtest['text_smtp_testing_mail'];
$body = <<<EOD
{$lang_mailtest['mail_test_mail_content']}
EOD;
sent_mail($email, $SITENAME, $SITEEMAIL, change_email_encode(get_langfolder_cookie(), $title), change_email_encode(get_langfolder_cookie(),$body), '', false, false, '', get_email_encode(get_langfolder_cookie()));
stderr($lang_mailtest['std_success'], $lang_mailtest['std_success_note']);
}
else
{
stdhead($lang_mailtest['head_mail_test']);
print("<h1 align=\"center\">".$lang_mailtest['text_mail_test']."</h1>");
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n");
print("<form method='post' action='mailtest.php'>");
print("<input type='hidden' name='action' value='sendmail'>");
tr($lang_mailtest['row_enter_email'], "<input type='text' name='email' size=35><br />".$lang_mailtest['text_enter_email_note'], 1);
print("<tr><td colspan=\"2\" align=\"center\"><input type='submit' name='sendmail' value='".$lang_mailtest['submit_send_it']."'></td></tr>");
print("</form></table>");
stdfoot();
}
?>
+178
View File
@@ -0,0 +1,178 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
if (get_user_class() < $pollmanage_class)
permissiondenied();
$action = $_GET["action"] ?? '';
$pollid = intval($_GET["pollid"] ?? 0);
$poll = [];
if ($action == "edit")
{
int_check($pollid,true);
$res = sql_query("SELECT * FROM polls WHERE id = $pollid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
stderr($lang_makepoll['std_error'], $lang_makepoll['std_no_poll_id']);
$poll = mysql_fetch_array($res);
}
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$pollid = intval($_POST["pollid"] ?? 0);
$question = htmlspecialchars($_POST["question"]);
$option0 = htmlspecialchars($_POST["option0"]);
$option1 = htmlspecialchars($_POST["option1"]);
$option2 = htmlspecialchars($_POST["option2"]);
$option3 = htmlspecialchars($_POST["option3"]);
$option4 = htmlspecialchars($_POST["option4"]);
$option5 = htmlspecialchars($_POST["option5"]);
$option6 = htmlspecialchars($_POST["option6"]);
$option7 = htmlspecialchars($_POST["option7"]);
$option8 = htmlspecialchars($_POST["option8"]);
$option9 = htmlspecialchars($_POST["option9"]);
$option10 = htmlspecialchars($_POST["option10"]);
$option11 = htmlspecialchars($_POST["option11"]);
$option12 = htmlspecialchars($_POST["option12"]);
$option13 = htmlspecialchars($_POST["option13"]);
$option14 = htmlspecialchars($_POST["option14"]);
$option15 = htmlspecialchars($_POST["option15"]);
$option16 = htmlspecialchars($_POST["option16"]);
$option17 = htmlspecialchars($_POST["option17"]);
$option18 = htmlspecialchars($_POST["option18"]);
$option19 = htmlspecialchars($_POST["option19"]);
$returnto = htmlspecialchars($_POST["returnto"]);
if (!$question || !$option0 || !$option1)
stderr($lang_makepoll['std_error'], $lang_makepoll['std_missing_form_data']);
if ($pollid)
sql_query("UPDATE polls SET " .
"question = " . sqlesc($question) . ", " .
"option0 = " . sqlesc($option0) . ", " .
"option1 = " . sqlesc($option1) . ", " .
"option2 = " . sqlesc($option2) . ", " .
"option3 = " . sqlesc($option3) . ", " .
"option4 = " . sqlesc($option4) . ", " .
"option5 = " . sqlesc($option5) . ", " .
"option6 = " . sqlesc($option6) . ", " .
"option7 = " . sqlesc($option7) . ", " .
"option8 = " . sqlesc($option8) . ", " .
"option9 = " . sqlesc($option9) . ", " .
"option10 = " . sqlesc($option10) . ", " .
"option11 = " . sqlesc($option11) . ", " .
"option12 = " . sqlesc($option12) . ", " .
"option13 = " . sqlesc($option13) . ", " .
"option14 = " . sqlesc($option14) . ", " .
"option15 = " . sqlesc($option15) . ", " .
"option16 = " . sqlesc($option16) . ", " .
"option17 = " . sqlesc($option17) . ", " .
"option18 = " . sqlesc($option18) . ", " .
"option19 = " . sqlesc($option19) . " " .
" WHERE id = $pollid") or sqlerr(__FILE__, __LINE__);
else
sql_query("INSERT INTO polls VALUES(0, " . sqlesc(date("Y-m-d H:i:s")) .", " .
sqlesc($question) . ", " .
sqlesc($option0) . ", " .
sqlesc($option1) . ", " .
sqlesc($option2) . ", " .
sqlesc($option3) . ", " .
sqlesc($option4) . ", " .
sqlesc($option5) . ", " .
sqlesc($option6) . ", " .
sqlesc($option7) . ", " .
sqlesc($option8) . ", " .
sqlesc($option9) . ", " .
sqlesc($option10) . ", " .
sqlesc($option11) . ", " .
sqlesc($option12) . ", " .
sqlesc($option13) . ", " .
sqlesc($option14) . ", " .
sqlesc($option15) . ", " .
sqlesc($option16) . ", " .
sqlesc($option17) . ", " .
sqlesc($option18) . ", " .
sqlesc($option19).")") or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('current_poll_content');
$Cache->delete_value('current_poll_result', true);
if ($returnto == "main")
header("Location: " . get_protocol_prefix() . "$BASEURL");
elseif ($pollid)
header("Location: " . get_protocol_prefix() . "$BASEURL/log.php?action=poll#$pollid");
else
header("Location: " . get_protocol_prefix() . "$BASEURL");
die;
}
if ($pollid){
stdhead($lang_makepoll['head_edit_poll']);
print("<h1>".$lang_makepoll['text_edit_poll']."</h1>");
}
else
{
stdhead($lang_makepoll['head_new_poll']);
// Warn if current poll is less than 3 days old
$res = sql_query("SELECT question, added FROM polls ORDER BY added DESC LIMIT 1") or sqlerr();
$arr = mysql_fetch_assoc($res);
if ($arr)
{
$hours = floor((strtotime(date("Y-m-d H:i:s")) - strtotime($arr["added"])) / 3600);
$days = floor($hours / 24);
if ($days < 3)
{
if ($days >= 1)
$t = $days.$lang_makepoll['text_day'] . add_s($days);
else
$t = $hours.$lang_makepoll['text_hour'] . add_s($hours);
print("<p><font class=striking><b>".$lang_makepoll['text_current_poll']."(<i>" . $arr["question"] . "</i>)".$lang_makepoll['text_is_only'].$t.$lang_makepoll['text_old']."</b></font></p>");
}
}
print("<h1>".$lang_makepoll['text_make_poll']."</h1>");
}
?>
<table border=1 cellspacing=0 cellpadding=5>
<form method=post action=makepoll.php>
<style type="text/css">
input.mp
{
width: 450px;
}
</style>
<tr><td class=rowhead><?php echo $lang_makepoll['text_question']?> <font color=red>*</font></td><td align=left><input name=question class=mp maxlength=255 value="<?php echo $poll['question'] ?? ''?>"></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>1 <font color=red>*</font></td><td align=left><input name=option0 class=mp maxlength=40 value="<?php echo $poll['option0'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>2 <font color=red>*</font></td><td align=left><input name=option1 class=mp maxlength=40 value="<?php echo $poll['option1'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>3</td><td align=left><input name=option2 class=mp maxlength=40 value="<?php echo $poll['option2'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>4</td><td align=left><input name=option3 class=mp maxlength=40 value="<?php echo $poll['option3'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>5</td><td align=left><input name=option4 class=mp maxlength=40 value="<?php echo $poll['option4'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>6</td><td align=left><input name=option5 class=mp maxlength=40 value="<?php echo $poll['option5'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>7</td><td align=left><input name=option6 class=mp maxlength=40 value="<?php echo $poll['option6'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>8</td><td align=left><input name=option7 class=mp maxlength=40 value="<?php echo $poll['option7'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>9</td><td align=left><input name=option8 class=mp maxlength=40 value="<?php echo $poll['option8'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>10</td><td align=left><input name=option9 class=mp maxlength=40 value="<?php echo $poll['option9'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>11</td><td align=left><input name=option10 class=mp maxlength=40 value="<?php echo $poll['option10'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>12</td><td align=left><input name=option11 class=mp maxlength=40 value="<?php echo $poll['option11'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>13</td><td align=left><input name=option12 class=mp maxlength=40 value="<?php echo $poll['option12'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>14</td><td align=left><input name=option13 class=mp maxlength=40 value="<?php echo $poll['option13'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>15</td><td align=left><input name=option14 class=mp maxlength=40 value="<?php echo $poll['option14'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>16</td><td align=left><input name=option15 class=mp maxlength=40 value="<?php echo $poll['option15'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>17</td><td align=left><input name=option16 class=mp maxlength=40 value="<?php echo $poll['option16'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>18</td><td align=left><input name=option17 class=mp maxlength=40 value="<?php echo $poll['option17'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>19</td><td align=left><input name=option18 class=mp maxlength=40 value="<?php echo $poll['option18'] ?? ''?>"><br /></td></tr>
<tr><td class=rowhead><?php echo $lang_makepoll['text_option']?>20</td><td align=left><input name=option19 class=mp maxlength=40 value="<?php echo $poll['option19'] ?? ''?>"><br /></td></tr>
<tr><td colspan=2 align=center><input type=submit value="<?php echo $pollid ? $lang_makepoll['submit_edit_poll'] : $lang_makepoll['submit_create_poll']?>" style='height: 20pt'></td></tr>
</table>
<p><font color=red>*</font><?php echo $lang_makepoll['text_required']?></p>
<?php
if ($pollid)
print("<input type=hidden name=pollid value=\"".$poll["id"]."\">");
?>
<input type=hidden name=returnto value="<?php echo htmlspecialchars($_GET["returnto"] ?? '') ? htmlspecialchars($_GET["returnto"] ?? '') : htmlspecialchars($_SERVER["HTTP_REFERER"] ?? '')?>">
</form>
<?php
stdfoot();
?>
+78
View File
@@ -0,0 +1,78 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_SYSOP)
stderr("Error", "Permission denied.");
$class = intval($_POST["class"] ?? 0);
if ($class)
int_check($class,true);
$or = $_POST["or"] ?? '';
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$res = sql_query("SELECT id, username, email FROM users WHERE class $or ".mysql_real_escape_string($class)) or sqlerr(__FILE__, __LINE__);
$subject = substr(htmlspecialchars(trim($_POST["subject"])), 0, 80);
if ($subject == "") $subject = "(no subject)";
$subject = "Fw: $subject";
$message1 = htmlspecialchars(trim($_POST["message"]));
if ($message1 == "") stderr("Error", "Empty message!");
while($arr=mysql_fetch_array($res)){
$to = $arr["email"];
$message = "Message received from ".$SITENAME." on " . date("Y-m-d H:i:s") . ".\n" .
"---------------------------------------------------------------------\n\n" .
$message1 . "\n\n" .
"---------------------------------------------------------------------\n$SITENAME\n";
$success = sent_mail($to,$SITENAME,$SITEEMAIL,$subject,$message,"Mass Mail",false);
}
if ($success)
stderr("Success", "Messages sent.");
else
stderr("Error", "Try again.");
}
stdhead("Mass E-mail Gateway");
?>
<p><table border=0 class=main cellspacing=0 cellpadding=0><tr>
<td class=embedded style='padding-left: 10px'><font size=3><b>Send mass e-mail to all members</b></font></td>
</tr></table></p>
<table border=1 cellspacing=0 cellpadding=5>
<form method=post action=massmail.php>
<?php
if (get_user_class() == UC_MODERATOR && $CURUSER["class"] > UC_POWER_USER)
printf("<input type=hidden name=class value=$CURUSER[class]\n");
else
{
$prefix = '';
print("<tr><td class=rowhead>Classe</td><td colspan=2 align=left><select name=or><option value='<'><<option value='>'>><option value='='>=<option value='<='><=<option value='>='>>=</select><select name=class>\n");
if (get_user_class() == UC_MODERATOR)
$maxclass = UC_POWER_USER;
else
$maxclass = get_user_class() - 1;
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i" . ($CURUSER["class"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
print("</select></td></tr>\n");
}
?>
<tr><td class=rowhead>Subject</td><td><input type=text name=subject size=80></td></tr>
<tr><td class=rowhead>Body</td><td><textarea name=message cols=80 rows=20></textarea></td></tr>
<tr><td colspan=2 align=center><input type=submit value="Send" class=btn></td></tr>
</form>
</table>
<?php
stdfoot();
+163
View File
@@ -0,0 +1,163 @@
<?php
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_SYSOP)
stderr("Error", "Permission denied.");
$action = isset($_POST['action']) ? htmlspecialchars($_POST['action']) : (isset($_GET['action']) ? htmlspecialchars($_GET['action']) : 'showlist');
$id = isset($_POST['id']) ? htmlspecialchars($_POST['id']) : (isset($_GET['id']) ? htmlspecialchars($_GET['id']) : '');
$update = isset($_POST['update']) ? htmlspecialchars($_POST['update']) : (isset($_GET['update']) ? htmlspecialchars($_GET['update']) : '');
function check ($id) {
if (!is_valid_id($id))
return stderr("Error","Invalid ID");
else
return true;
}
function safe_query ($query,$id,$where = '') {
$query = sprintf("$query WHERE id ='%s'",
mysql_real_escape_string($id));
$result = sql_query($query);
if (!$result)
return sqlerr(__FILE__,__LINE__);
redirect("maxlogin.php?update=".htmlspecialchars($where));
}
function searchform () {
?>
<br />
<form method=post name=search action=maxlogin.php?>
<input type=hidden name=action value=searchip>
<p class=success align=center>Search IP <input type=text name=ip size=25> <input type=submit name=submit value='Search IP' class=btn></p>
</form>
<?php
}
$countrows = number_format(get_row_count("loginattempts")) + 1;
$page = intval($_GET["page"] ?? 0);
$order = $_GET['order'] ?? '';
if ($order == 'id')
$orderby = "id";
elseif ($order == 'ip')
$orderby = "ip";
elseif ($order == 'added')
$orderby = "added";
elseif ($order == 'attempts')
$orderby = "attempts";
elseif ($order == 'type')
$orderby = "type";
elseif ($order == 'status')
$orderby = "banned";
else
$orderby = "attempts";
$perpage = 5;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $countrows, "maxlogin.php?order=$order&");
$msg = '';
if ($action == 'showlist') {
stdhead ("Max. Login Attemps - Show List");
print("<h1>Failed Login Attempts</h1>");
print("<table border=1 cellspacing=0 cellpadding=5 width=100%>\n");
if ($update)
$msg = "<tr><td colspan=6><b>".htmlspecialchars($update)." Successful!</b></td></tr>\n";
$res = sql_query("SELECT * FROM loginattempts ORDER BY $orderby DESC $limit") or sqlerr(__FILE__,__LINE__);
if (mysql_num_rows($res) == 0)
print("<tr><td colspan=2><b>Nothing found</b></td></tr>\n");
else
{
print("<tr><td class=colhead><a href=?order=id>ID</a></td><td class=colhead align=left><a href=?order=ip>Ip Address</a></td><td class=colhead align=left><a href=?order=added>Action Time</a></td>".
"<td class=colhead align=left><a href=?order=attempts>Attempts</a></td><td class=colhead align=left><a href=?order=type>Attempt Type</a></td><td class=colhead align=left><a href=?order=status>Status</a></td></tr>\n");
while ($arr = mysql_fetch_assoc($res))
{
$r2 = sql_query("SELECT id,username FROM users WHERE ip=".sqlesc($arr[ip])) or sqlerr(__FILE__,__LINE__);
$a2 = mysql_fetch_assoc($r2);
print("<tr><td align=>$arr[id]</td><td align=left>$arr[ip] " . ($a2[id] ? get_username($a2['id']) : "" ) . "</td><td align=left>$arr[added]</td><td align=left>$arr[attempts]</td><td align=left>".($arr[type] == "recover" ? "Recover Password Attempt!" : "Login Attempt!")."</td><td align=left>".($arr[banned] == "yes" ? "<font color=red><b>banned</b></font> <a href=maxlogin.php?action=unban&id=$arr[id]><font color=green>[<b>unban</b>]</font></a>" : "<font color=green><b>not banned</b></font> <a href=maxlogin.php?action=ban&id=$arr[id]><font color=red>[<b>ban</b>]</font></a>")." <a OnClick=\"return confirm('Are you wish to delete this attempt?');\" href=maxlogin.php?action=delete&id=$arr[id]>[<b>delete</b></a>] <a href=maxlogin.php?action=edit&id=$arr[id]><font color=blue>[<b>edit</b></a>]</font></td></tr>\n");
}
}
print($msg);
print("</table>\n");
if ($countrows > $perpage)
echo '<tr><td colspan=2>'.$pagerbottom.'</td></tr>';
searchform();
stdfoot();
}elseif ($action == 'ban') {
check($id);
stdhead ("Max. Login Attemps - BAN");
safe_query("UPDATE loginattempts SET banned = 'yes'",$id,"Ban");
header("Location: maxlogin.php?update=Ban");
}elseif ($action == 'unban') {
check($id);
stdhead ("Max. Login Attemps - UNBAN");
safe_query("UPDATE loginattempts SET banned = 'no'",$id,"Unban");
}elseif ($action == 'delete') {
check($id);
stdhead ("Max. Login Attemps - DELETE");
safe_query("DELETE FROM loginattempts",$id,"Delete");
}elseif ($action == 'edit') {
check($id);
stdhead ("Max. Login Attemps - EDIT (".htmlspecialchars($id).")");
$query = sprintf("SELECT * FROM loginattempts WHERE id ='%s'",
mysql_real_escape_string($id));
$result = sql_query($query) or sqlerr(__FILE__,__LINE__);
$a = mysql_fetch_array($result);
print("<table border=1 cellspacing=0 cellpadding=5 width=100%>\n");
print("<tr><td><p>IP Address: <b>".htmlspecialchars($a[ip])."</b></p>");
print("<p>Action Time: <b>".htmlspecialchars($a[added])."</b></p></tr></td>");
print("<form method='post' action='maxlogin.php'>");
print("<input type='hidden' name='action' value='save'>");
print("<input type='hidden' name='id' value='$a[id]'>");
print("<input type='hidden' name='ip' value='$a[ip]'>");
if ($_GET['return'] == 'yes')
print("<input type='hidden' name='returnto' value='viewunbaniprequest.php'>");
print("<tr><td>Attempts <input type='text' size='33' name='attempts' value='$a[attempts]'>");
print("<tr><td>Attempt Type <select name='type'><option value='login' ".($a["type"] == "login" ? "selected" : "").">Login Attempt</option><option value='recover' ".($a["type"] == "recover" ? "selected" : "").">Recover Password Attempts</option></select></tr></td>");
print("<tr><td>Current Status <select name='banned'><option value='yes' ".($a["banned"] == "yes" ? "selected" : "").">Banned!</option><option value='no' ".($a["banned"] == "no" ? "selected" : "").">Not Banned!</option></select></tr></td>");
print("<tr><td><input type='submit' name='submit' value='Save' class=btn></tr></td>");
print("</table>");
stdfoot();
}elseif ($action == 'save') {
$id = sqlesc(intval($_POST['id'] ?? 0));
$ip = sqlesc($_POST['ip']);
$attempts = sqlesc($_POST['attempts']);
$type = sqlesc($_POST['type']);
$banned = sqlesc($_POST['banned']);
check($id);
check($attempts);
sql_query("UPDATE loginattempts SET attempts = $attempts, type = $type, banned = $banned WHERE id = $id LIMIT 1") or sqlerr(__FILE__,__LINE__);
if ($_POST['returnto']){
$returnto = $_POST['returnto'];
header("Location: $returnto");
}
else
header("Location: maxlogin.php?update=Edit");
}elseif ($action == 'searchip') {
$ip = mysql_real_escape_string($_POST['ip']);
$search = sql_query("SELECT * FROM loginattempts WHERE ip LIKE '%$ip%'") or sqlerr(__FILE__,__LINE__);
stdhead ("Max. Login Attemps - Search");
print("<h2>Failed Login Attempts</h2>");
print("<table border=1 cellspacing=0 cellpadding=5 width=100%>\n");
if (mysql_num_rows($search) == 0)
print("<tr><td colspan=2><b>Sorry, nothing found!</b></td></tr>\n");
else
{
print("<tr><td class=colhead><a href=?order=id>ID</a></td><td class=colhead align=left><a href=?order=ip>Ip Address</a></td><td class=colhead align=left><a href=?order=added>Action Time</a></td>".
"<td class=colhead align=left><a href=?order=attempts>Attempts</a></td><td class=colhead align=left><a href=?order=type>Attempt Type</a></td><td class=colhead align=left><a href=?order=status>Status</a></td></tr>\n");
while ($arr = mysql_fetch_assoc($search))
{
$r2 = sql_query("SELECT id,username FROM users WHERE ip=".sqlesc($arr[ip])) or sqlerr(__FILE__,__LINE__);
$a2 = mysql_fetch_assoc($r2);
print("<tr><td align=>$arr[id]</td><td align=left>$arr[ip] " . ($a2[id] ? get_username($a2[id]) : "" ) . "</td><td align=left>$arr[added]</td><td align=left>$arr[attempts]</td><td align=left>".($arr[type] == "recover" ? "Recover Password Attempt!" : "Login Attempt!")."</td><td align=left>".($arr[banned] == "yes" ? "<font color=red><b>banned</b></font> <a href=maxlogin.php?action=unban&id=$arr[id]><font color=green>[<b>unban</b>]</font></a>" : "<font color=green><b>not banned</b></font> <a href=maxlogin.php?action=ban&id=$arr[id]><font color=red>[<b>ban</b>]</font></a>")." <a OnClick=\"return confirm('Are you wish to delete this attempt?');\" href=maxlogin.php?action=delete&id=$arr[id]>[<b>delete</b></a>] <a href=maxlogin.php?action=edit&id=$arr[id]><font color=blue>[<b>edit</b></a>]</font></td></tr>\n");
}
}
print("</table>\n");
searchform();
stdfoot();
}
else
stderr("Error","Invalid Action");
?>
+722
View File
@@ -0,0 +1,722 @@
<?php
require_once("../include/bittorrent.php");
// Connect to DB & check login
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
// Define constants
define('PM_DELETED',0); // Message was deleted
define('PM_INBOX',1); // Message located in Inbox for reciever
define('PM_SENTBOX',-1); // GET value for sent box
// Determine action
$action = $_GET['action'] ?? '';
if (!$action)
{
$action = $_POST['action'] ?? '';
if (!$action)
$action = 'viewmailbox';
}
// View listing of Messages in mail box
if ($action == "viewmailbox")
{
// Get Mailbox Number
$mailbox = $_GET['box'] ?? 0;
if (!$mailbox)
$mailbox = PM_INBOX;
// Get Mailbox Name
if ($mailbox != PM_INBOX && $mailbox != PM_SENTBOX)
{
$res = sql_query('SELECT name FROM pmboxes WHERE userid=' . sqlesc($CURUSER['id']) . ' AND boxnumber=' . sqlesc($mailbox) . ' LIMIT 1') or sqlerr(__FILE__,__LINE__);
if (mysql_num_rows($res) == 0)
stderr($lang_messages['std_error'],$lang_messages['std_invalid_mailbox']);
$mailbox_name = mysql_fetch_array($res);
$mailbox_name = htmlspecialchars($mailbox_name[0]);
}
else
{
if ($mailbox == PM_INBOX)
$mailbox_name = $lang_messages['text_inbox'];
else
$mailbox_name = $lang_messages['text_sentbox'];
}
if ($mailbox != PM_SENTBOX)
$sender_receiver = $lang_messages['text_sender'];
else
$sender_receiver = $lang_messages['text_receiver'];
// Start Page
stdhead($mailbox_name);
?>
<?php messagemenu($mailbox)?>
<table border="0" cellpadding="4" cellspacing="0" width="737">
<tr><td class=colhead align=left><?php echo $lang_messages['col_search_message'] ?></td></tr>
<tr><td class=toolbox align=center><?php echo insertJumpTo($mailbox);?></td></tr>
</table>
<?php
//search
$keyword = mysql_real_escape_string(trim($_GET["keyword"] ?? ''));
$place = $_GET["place"] ?? '';
if($keyword)
switch ($place){
case "body": $wherea=" AND msg LIKE '%$keyword%' "; break;
case "title": $wherea=" AND subject LIKE '%$keyword%' "; break;
case "both": $wherea=" AND (msg LIKE '%$keyword%' or subject LIKE '%$keyword%') "; break;
default: $wherea=" AND (msg LIKE '%$keyword%' or subject LIKE '%$keyword%') "; break;
}
else
$wherea="";
$unread=$_GET["unread"] ?? '';
if ($unread)
switch ($unread){
case "yes": $wherea.=" AND unread = 'yes' "; break;
case "no": $wherea.=" AND unread = 'no' "; break;
}
if ($mailbox != PM_SENTBOX)
{
$res = sql_query('SELECT COUNT(*) FROM messages WHERE receiver=' . sqlesc($CURUSER['id']) . ' AND location=' . sqlesc($mailbox).$wherea);
$row = mysql_fetch_array($res);
$count = $row[0];
$perpage = ($CURUSER['pmnum'] ? $CURUSER['pmnum'] : 20);
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "?action=viewmailbox".($mailbox ? "&box=".$mailbox : "").($place ? "&place=".$place : "").($keyword ? "&keyword=".rawurlencode($keyword) : "").($unread ? "&unread=".$unread : "")."&");
$res = sql_query('SELECT * FROM messages WHERE receiver=' . sqlesc($CURUSER['id']) . ' AND location=' . sqlesc($mailbox) .$wherea. ' ORDER BY id DESC '.$limit) or
sqlerr(__FILE__,__LINE__);
}
else
{
$res = sql_query('SELECT COUNT(*) FROM messages WHERE sender=' . sqlesc($CURUSER['id']) . ' AND saved=\'yes\''.$wherea);
$row = mysql_fetch_array($res);
$count = $row[0];
$perpage = ($CURUSER['pmnum'] ? $CURUSER['pmnum'] : 20);
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "?action=viewmailbox".($mailbox ? "&box=".$mailbox : "").($place ? "&place=".$place : "").($keyword ? "&keyword=".rawurlencode($keyword) : "").($unread ? "&unread=".$unread : "")."&");
$res = sql_query('SELECT * FROM messages WHERE sender=' . sqlesc($CURUSER['id']) . ' AND saved=\'yes\''.$wherea.' ORDER BY id DESC '.$limit) or sqlerr(__FILE__,__LINE__);
}
if (mysql_num_rows($res) == 0)
{
echo("<p align=\"center\">".$lang_messages['text_no_messages']."</p>\n");
}
else
{
echo $pagertop;
?>
<form action="messages.php" method="post">
<input type="hidden" name="action" value="moveordel">
<table border="0" cellpadding="4" cellspacing="0" width="737">
<tr>
<td width="1%" class="colhead" align="center"><?php echo $lang_messages['col_status'] ?></td>
<td class="colhead" align="left"><?php echo $lang_messages['col_subject'] ?> </td>
<?php
print("<td width=\"35%\" class=\"colhead\" align=\"left\">$sender_receiver</td>");
?>
<td width="1%" class="colhead" align="center"><img class="time" src="pic/trans.gif" alt="time" title="<?php echo $lang_messages['col_date'] ?>" /></td>
<td width="1%" class="colhead" align="center"><?php echo $lang_messages['col_act'] ?></td>
</tr>
<?php
while ($row = mysql_fetch_assoc($res))
{
// Get Sender Username
if ($row['sender'] != 0)
{
if ($mailbox != PM_SENTBOX)
$username = get_username($row['sender']);
else
$username = get_username($row['receiver']);
}
else
{
$username = $lang_messages['text_system'];
}
$subject = htmlspecialchars($row['subject']);
if (strlen($subject) <= 0)
{
$subject = $lang_messages['text_no_subject'];
}
if ($row['unread'] == 'yes')
{
echo("<tr>\n<td class=rowfollow align=center><img class=\"unreadpm\" src=\"pic/trans.gif\" alt=\"Unread\" title=".$lang_messages['title_unread']." /></td>\n");
}
else
{
echo("<tr>\n<td class=rowfollow align=center><img class=\"readpm\" src=\"pic/trans.gif\" alt=\"Read\" title=".$lang_messages['title_read']." /></td>\n");
}
echo("<td class=rowfollow align=left><a href=\"messages.php?action=viewmessage&id=" . $row['id'] . "\">" .
$subject . "</a></td>\n");
echo("<td class=rowfollow align=left>$username</td>\n");
echo("<td class=rowfollow nowrap>" . gettime($row['added'],true,false) . "</td>\n");
echo("<td class=rowfollow><input class=checkbox type=\"checkbox\" name=\"messages[]\" value=\"" . $row['id'] . "\"></td>\n</tr>\n");
}
?>
<tr class="colhead">
<td colspan="5" align="right" class="colhead"><input class=btn type="button" value="<?php echo $lang_messages['input_check_all']; ?>" onClick="this.value=check(form,'<?php echo $lang_messages['input_check_all'] ?>','<?php echo $lang_messages['input_uncheck_all'] ?>')">
<?php if($mailbox != PM_SENTBOX) print("<input class=btn type=\"submit\" name=\"markread\" value=\"".$lang_messages['submit_mark_as_read']."\">") ?>
<input class=btn type="submit" name="delete" value=<?php echo $lang_messages['submit_delete']?>>
<?php
if($mailbox != PM_SENTBOX){
echo $lang_messages['text_or'];
print("<input class=btn type=\"submit\" name=\"move\" value=\"".$lang_messages['submit_move_to']."\"> <select name=\"box\"><option value=\"1\">".$lang_messages['text_inbox']."</option>");
$res = sql_query('SELECT * FROM pmboxes WHERE userid=' . sqlesc($CURUSER['id']) . ' ORDER BY boxnumber') or sqlerr(__FILE__,__LINE__);
while ($row = mysql_fetch_assoc($res))
{
echo("<option value=\"" . $row['boxnumber'] . "\">" . htmlspecialchars($row['name']) . "</option>\n");
}
}
?>
<?php /*
print("<p align=right><input type=button value=\"Check All\" onClick=\"this.value=check(form)\"><input type=submit value=\"Delete selected\"></p>");
print("</form>");
*/ ?>
</select>
</td>
</tr>
</form><tr><td class=toolbox colspan=5>
<div align="center"><img class="unreadpm" src="pic/trans.gif" alt="Unread" title="<?php echo $lang_messages['title_unread'] ?>" /><a href="messages.php?action=viewmailbox&box=<?php echo $mailbox?>&unread=yes"><?php echo $lang_messages['text_unread_messages'] ?></a>
<img class="readpm" src="pic/trans.gif" alt="Read" title="<?php echo $lang_messages['title_read'] ?>" /><a href="messages.php?action=viewmailbox&box=<?php echo $mailbox?>&unread=no"><?php echo $lang_messages['text_read_messages'] ?></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="messages.php?action=editmailboxes"><b><?php echo $lang_messages['text_mailbox_manager'] ?></a></b></div></td></tr></table>
<?php
}
stdfoot();
}
if ($action == "viewmessage")
{
$pm_id = (int) $_GET['id'];
if (!$pm_id)
{
stderr($lang_messages['std_error'],$lang_messages['std_no_permission']);
}
// Get the message
$res = sql_query('SELECT * FROM messages WHERE id=' . sqlesc($pm_id) . ' AND (receiver=' . sqlesc($CURUSER['id']) . ' OR (sender=' . sqlesc($CURUSER['id'])
. ' AND saved=\'yes\')) LIMIT 1') or sqlerr(__FILE__,__LINE__);
if (!$res)
{
stderr($lang_messages['std_error'],$lang_messages['std_no_permission']);
}
// Prepare for displaying message
$message = mysql_fetch_assoc($res) or header("Location: messages.php");
if ($message['sender'] == $CURUSER['id'])
{
// Display to
$sender = get_username($message['receiver']);
$reply = "";
$from = $lang_messages['text_to'];
}
else
{
$from = $lang_messages['text_from'];
if ($message['sender'] == 0)
{
$sender = $lang_messages['text_system'];
$reply = "";
}
else
{
$sender = get_username($message['sender']);
$reply = " [ <a href=\"sendmessage.php?receiver=" . $message['sender'] . "&replyto=" . $pm_id . "\">".$lang_messages['text_reply']."</a> ]";
}
}
$body = format_comment($message['msg']);
$added = $message['added'];
if ($message['sender'] == $CURUSER['id'])
{
$unread = ($message['unread'] == 'yes' ? "<span style=\"color: #FF0000;\"><b>".$lang_messages['text_new']."</b></a>" : "");
}
else
{
$unread = "";
}
$subject = htmlspecialchars($message['subject']);
if (strlen($subject) <= 0)
{
$subject = $lang_messages['text_no_subject'];
}
// Mark message unread
sql_query("UPDATE messages SET unread='no' WHERE id=" . sqlesc($pm_id) . " AND receiver=" . sqlesc($CURUSER['id']) . " LIMIT 1");
$Cache->delete_value('user_'.$CURUSER['id'].'_unread_message_count');
// Display message
stdhead("PM ($subject)"); ?>
<h1><?php echo $subject?></h1>
<?php
$mailbox = ($message['sender'] == $CURUSER['id'] ? -1 : $message['location']);
messagemenu($mailbox);
?>
<table width="737" border="0" cellpadding="4" cellspacing="0">
<tr>
<td width="50%" class="colhead" align="left"><?php echo $from?></td>
<td width="50%" class="colhead" align="left"><?php echo $lang_messages['col_date'] ?></td>
</tr>
<tr>
<td class="rowfollow" align="left"><?php echo $sender?></td>
<td class="rowfollow" align="left"><?php echo gettime($added,true,false)?>&nbsp;&nbsp;<?php echo $unread?></td>
</tr>
<tr>
<td colspan="2" align="left"><?php echo $body?></td>
</tr>
<tr>
<td align=left>
<?php if($message['sender'] != $CURUSER['id']){
print("<form action=\"messages.php\" method=\"post\"><input type=\"hidden\" name=\"action\" value=\"moveordel\"><input type=\"hidden\" name=\"id\" value=".$pm_id.">
<input type=\"submit\" name=\"move\" value=".$lang_messages['submit_move_to']."><select name=\"box\"><option value=\"1\">".$lang_messages['text_inbox']."</option>");
$res = sql_query('SELECT * FROM pmboxes WHERE userid=' . sqlesc($CURUSER['id']) . ' ORDER BY boxnumber') or sqlerr(__FILE__,__LINE__);
while ($row = mysql_fetch_assoc($res))
{
echo("<option value=\"" . $row['boxnumber'] . "\">" . htmlspecialchars($row['name']) . "</option>\n");
}
print("</select></form>");
}
?>
</td><td align="right" ><font color=white>[ <a href="messages.php?action=deletemessage&id=<?php echo $pm_id?>"><?php echo $lang_messages['text_delete'] ?></a> ]<?php echo $reply?> [ <a
href="messages.php?action=forward&id=<?php echo $pm_id?>"><?php echo $lang_messages['text_forward_pm'] ?></a> ]</font></td>
</tr>
</table>
<?php
stdfoot();
}
if ($action == "moveordel")
{
$pm_id = (int) $_POST['id'];
$pm_box = (int) $_POST['box'];
$pm_messages = $_POST['messages'];
if ($_POST['markread'])
{
if ($pm_id)
{
//Mark a single message as read
@sql_query("UPDATE messages SET unread='no' WHERE id=" . sqlesc($pm_id) . " AND receiver=" . $CURUSER['id'] . " LIMIT 1");
}
else
{
// Mark multiple messages as read
@sql_query("UPDATE messages SET unread='no' WHERE id IN (" . implode(", ", array_map("sqlesc",$pm_messages)) . ") AND receiver=" .$CURUSER['id']);
}
$Cache->delete_value('user_'.$CURUSER['id'].'_unread_message_count');
// Check if messages were moved
if (@mysql_affected_rows() == 0)
{
stderr($lang_messages['std_error'],$lang_messages['std_cannot_mark_messages']);
}
header("Location: messages.php?action=viewmailbox&box=" . $pm_box);
exit();
}
elseif ($_POST['move'])
{
if ($pm_id)
{
// Move a single message
@sql_query("UPDATE messages SET location=" . sqlesc($pm_box) . " WHERE id=" . sqlesc($pm_id) . " AND receiver=" . $CURUSER['id'] . " LIMIT 1");
}
else
{
// Move multiple messages
@sql_query("UPDATE messages SET location=" . sqlesc($pm_box) . " WHERE id IN (" . implode(", ", array_map("sqlesc",$pm_messages)) . ') AND receiver=' .$CURUSER['id']);
}
// Check if messages were moved
if (@mysql_affected_rows() == 0)
{
stderr($lang_messages['std_error'],$lang_messages['std_cannot_move_messages']);
}
$Cache->delete_value('user_'.$CURUSER['id'].'_unread_message_count');
$Cache->delete_value('user_'.$CURUSER['id'].'_inbox_count');
$Cache->delete_value('user_'.$CURUSER["id"].'_outbox_count');
header("Location: messages.php?action=viewmailbox&box=" . $pm_box);
exit();
}
elseif ($_POST['delete'])
{
if ($pm_id)
{
// Delete a single message
$res = sql_query("SELECT * FROM messages WHERE id=" . sqlesc($pm_id)) or sqlerr(__FILE__,__LINE__);
$message = mysql_fetch_assoc($res);
if ($message['receiver'] == $CURUSER['id'] && $message['saved'] == 'no')
{
sql_query("DELETE FROM messages WHERE id=" . sqlesc($pm_id)) or sqlerr(__FILE__,__LINE__);
$Cache->delete_value('user_'.$CURUSER['id'].'_unread_message_count');
$Cache->delete_value('user_'.$CURUSER['id'].'_inbox_count');
}
elseif ($message['sender'] == $CURUSER['id'] && $message['location'] == PM_DELETED)
{
sql_query("DELETE FROM messages WHERE id=" . sqlesc($pm_id)) or sqlerr(__FILE__,__LINE__);
$Cache->delete_value('user_'.$CURUSER["id"].'_outbox_count');
}
elseif ($message['receiver'] == $CURUSER['id'] && $message['saved'] == 'yes')
{
sql_query("UPDATE messages SET location=0, unread = 'no' WHERE id=" . sqlesc($pm_id)) or sqlerr(__FILE__,__LINE__);
$Cache->delete_value('user_'.$CURUSER['id'].'_unread_message_count');
$Cache->delete_value('user_'.$CURUSER['id'].'_inbox_count');
}
elseif ($message['sender'] == $CURUSER['id'] && $message['location'] != PM_DELETED)
{
sql_query("UPDATE messages SET saved='no' WHERE id=" . sqlesc($pm_id)) or sqlerr(__FILE__,__LINE__);
$Cache->delete_value('user_'.$CURUSER["id"].'_outbox_count');
}
}
else
{
if (!$pm_messages)
stderr($lang_messages['std_error'], $lang_messages['std_no_message_selected']);
// Delete multiple messages
foreach ($pm_messages as $id)
{
$res = sql_query("SELECT * FROM messages WHERE id=" . sqlesc((int) $id));
$message = mysql_fetch_assoc($res);
if ($message['receiver'] == $CURUSER['id'] && $message['saved'] == 'no')
{
sql_query("DELETE FROM messages WHERE id=" . sqlesc((int) $id)) or sqlerr(__FILE__,__LINE__);
}
elseif ($message['sender'] == $CURUSER['id'] && $message['location'] == PM_DELETED)
{
sql_query("DELETE FROM messages WHERE id=" . sqlesc((int) $id)) or sqlerr(__FILE__,__LINE__);
}
elseif ($message['receiver'] == $CURUSER['id'] && $message['saved'] == 'yes')
{
sql_query("UPDATE messages SET location=0, unread = 'no' WHERE id=" . sqlesc((int) $id)) or sqlerr(__FILE__,__LINE__);
}
elseif ($message['sender'] == $CURUSER['id'] && $message['location'] != PM_DELETED)
{
sql_query("UPDATE messages SET saved='no' WHERE id=" . sqlesc((int) $id)) or sqlerr(__FILE__,__LINE__);
}
}
$Cache->delete_value('user_'.$CURUSER['id'].'_unread_message_count');
$Cache->delete_value('user_'.$CURUSER['id'].'_inbox_count');
$Cache->delete_value('user_'.$CURUSER["id"].'_outbox_count');
}
// Check if messages were moved
if (@mysql_affected_rows() == 0)
{
stderr($lang_messages['std_error'],$lang_messages['std_cannot_delete_messages']);
}
else
{
header("Location: messages.php?action=viewmailbox");
exit();
}
}
stderr($lang_messages['std_error'],$lang_messages['std_no_action']);
}
if ($action == "forward")
{
// Display form
$pm_id = (int) $_GET['id'];
// Get the message
$res = sql_query('SELECT * FROM messages WHERE id=' . sqlesc($pm_id) . ' AND (receiver=' . sqlesc($CURUSER['id']) . ' OR sender=' . sqlesc($CURUSER['id']) .') LIMIT 1') or sqlerr(__FILE__,__LINE__);
if (!$res)
{
stderr($lang_messages['std_error'],$lang_messages['std_no_permission_forwarding']);
}
if (mysql_num_rows($res) == 0)
{
stderr($lang_messages['std_error'],$lang_messages['std_no_permission_forwarding']);
}
$message = mysql_fetch_assoc($res);
// Prepare variables
$subject = "Fwd: " . htmlspecialchars($message['subject']);
$from = $message['receiver'];
$orig = $message['sender'];
$from_name = get_username($from);
if ($orig == 0)
{
$orig_name = $orig_name2 = $lang_messages['text_system'];
}
else
{
$orig_name = get_username($orig);
$res = sql_query("SELECT username FROM users WHERE id=" . sqlesc($orig)) or sqlerr(__FILE__,__LINE__);
$orig_nameres = mysql_fetch_array($res);
$orig_name2 = $orig_nameres['username'];
}
$body = "-------- Original Message from " . $orig_name2 . " --------<br />" . format_comment($message['msg']);
stdhead($subject);?>
<h1 align="center"><?php echo $lang_messages['text_forward_pm'] ?></h1>
<table border="0" cellpadding="4" cellspacing="0" width="737">
<form action="takemessage.php" method="post">
<input type="hidden" name="forward" value="1">
<input type="hidden" name="origmsg" value="<?php echo $pm_id?>">
<tr>
<td class="rowhead" align="right"><?php echo $lang_messages['row_to'] ?></td>
<td class="rowfollow" align=left><input type="text" name="to" style="width: 200px"></td>
</tr>
<tr>
<td class="rowhead" align="right"><?php echo $lang_messages['row_original_receiver'] ?></td>
<td class="rowfollow" align=left><?php echo $from_name?></td>
</tr>
<tr>
<td class="rowhead" align="right"><?php echo $lang_messages['row_original_sender'] ?></td>
<td class="rowfollow" align=left><?php echo $orig_name?></td>
</tr>
<tr>
<td class="rowhead" align="right"><?php echo $lang_messages['row_subject'] ?></td>
<td class="rowfollow" align=left><input type="text" name="subject" value="<?php echo $subject?>" style="width: 500px"></td>
</tr>
<tr>
<td class="rowhead" align="right" valign="top"><nobr><?php echo $lang_messages['row_message'] ?></nobr></td>
<td class="rowfollow" align=left><textarea name="body" style="width: 500px" rows="8"></textarea><br /><?php echo $body?></td>
</tr>
<tr>
<td class=toolbox colspan="2" align="center"><input class=checkbox type="checkbox" name="save" value="yes"<?php echo $CURUSER['savepms'] == 'yes'?" checked":""?>><?php echo $lang_messages['checkbox_save_message'] ?>&nbsp;
<input type="submit" class="btn" value=<?php echo $lang_messages['submit_forward']?>></td>
</tr>
</table>
</form>
<?php
stdfoot();
}
if ($action == "editmailboxes")
{
$res = sql_query("SELECT * FROM pmboxes WHERE userid=" . sqlesc($CURUSER['id'])) or sqlerr(__FILE__,__LINE__);
stdhead($lang_messages['head_editing_mailboxes']); ?>
<h1><?php echo $lang_messages['text_editing_mailboxes'] ?></h1>
<table width="737" border="0" cellpadding="4" cellspacing="0">
<tr>
<td class="colhead" align="left"><?php echo $lang_messages['text_add_mailboxes'] ?></td>
</tr>
<tr>
<td align=left><?php echo $lang_messages['text_extra_mailboxes_note'] ?><br />
<form action="messages.php" method="get">
<input type="hidden" name="action" value="editmailboxes2">
<input type="hidden" name="action2" value="add">
<input type="text" name="new1" size="40" maxlength="14"><br />
<input type="text" name="new2" size="40" maxlength="14"><br />
<input type="text" name="new3" size="40" maxlength="14"><br />
<input type="submit" value="<?php echo $lang_messages['submit_add'] ?>">
</form></td>
</tr>
<tr>
<td class="colhead" align=left><?php echo $lang_messages['text_edit_mailboxes'] ?></td>
</tr>
<tr>
<td align=left><?php echo $lang_messages['text_edit_mailboxes_note'] ?>
<form action="messages.php" method="get">
<input type="hidden" name="action" value="editmailboxes2">
<input type="hidden" name="action2" value="edit">
<?php
if (!$res)
{
echo ("<span align=\"center\"><b>".$lang_messages['text_no_mailboxes_to_edit']."<b></span>");
}
if (mysql_num_rows($res) == 0)
{
echo ("<span align=\"center\"><b>".$lang_messages['text_no_mailboxes_to_edit']."</b></span>");
}
else
{
while ($row = mysql_fetch_assoc($res))
{
$id = $row['id'];
$name = htmlspecialchars($row['name']);
echo("<input type=\"text\" name=\"edit$id\" value=\"$name\" size=\"40\" maxlength=\"14\"><br />\n");
}
echo("<input type=\"submit\" value=".$lang_messages['submit_edit'].">");
}
?></form></td>
</tr>
</table>
<?php
stdfoot();
}
if ($action == "editmailboxes2")
{
$action2 = (string) $_GET['action2'];
if (!$action2)
{
stderr($lang_messages['std_error'],$lang_messages['std_no_action']);
}
if ($action2 == "add")
{
$nameone = $_GET['new1'];
$nametwo = $_GET['new2'];
$namethree = $_GET['new3'];
// Get current max box number
$res = sql_query("SELECT MAX(boxnumber) FROM pmboxes WHERE userid=" . sqlesc($CURUSER['id']));
$box = mysql_fetch_array($res);
$box = (int) $box[0];
if ($box < 2)
{
$box = 1;
}
if (strlen($nameone) > 0)
{
++$box;
sql_query("INSERT INTO pmboxes (userid, name, boxnumber) VALUES (" . sqlesc($CURUSER['id']) . ", " . sqlesc($nameone) . ", $box)") or sqlerr(__FILE__,__LINE__);
}
if (strlen($nametwo) > 0)
{
++$box;
sql_query("INSERT INTO pmboxes (userid, name, boxnumber) VALUES (" . sqlesc($CURUSER['id']) . ", " . sqlesc($nametwo) . ", $box)") or sqlerr(__FILE__,__LINE__);
}
if (strlen($namethree) > 0)
{
++$box;
sql_query("INSERT INTO pmboxes (userid, name, boxnumber) VALUES (" . sqlesc($CURUSER['id']) . ", " . sqlesc($namethree) . ", $box)") or sqlerr(__FILE__,__LINE__);
}
header("Location: messages.php?action=editmailboxes");
exit();
}
if ($action2 == "edit");
{
$res = sql_query("SELECT * FROM pmboxes WHERE userid=" . sqlesc($CURUSER['id']));
if (!$res)
{
stderr($lang_messages['std_error'],$lang_messages['text_no_mailboxes_to_edit']);
}
if (mysql_num_rows($res) == 0)
{
stderr($lang_messages['std_error'],$lang_messages['text_no_mailboxes_to_edit']);
}
else
{
while ($row = mysql_fetch_assoc($res))
{
if (isset($_GET['edit' . $row['id']]))
{
if ($_GET['edit' . $row['id']] != $row['name'])
{
// Do something
if (strlen($_GET['edit' . $row['id']]) > 0)
{
// Edit name
sql_query("UPDATE pmboxes SET name=" . sqlesc($_GET['edit' . $row['id']]) . " WHERE id=" . sqlesc($row['id']) . " LIMIT 1");
}
else
{
// Delete
sql_query("DELETE FROM pmboxes WHERE id=" . sqlesc($row['id']) . " LIMIT 1");
// Delete all messages from this folder (uses multiple queries because we can only perform security checks in WHERE clauses)
sql_query("UPDATE messages SET location=0 WHERE saved='yes' AND location=" . sqlesc($row['boxnumber']) . " AND receiver=" . sqlesc($CURUSER['id']));
sql_query("UPDATE messages SET saved='no' WHERE saved='yes' AND sender=" . sqlesc($CURUSER['id']));
sql_query("DELETE FROM messages WHERE saved='no' AND location=" . sqlesc($row['boxnumber']) . " AND receiver=" . sqlesc($CURUSER['id']));
sql_query("DELETE FROM messages WHERE location=0 AND saved='yes' AND sender=" . sqlesc($CURUSER['id']));
}
}
}
}
header("Location: messages.php?action=editmailboxes");
exit();
}
}
}
if ($action == "deletemessage")
{
$pm_id = (int) $_GET['id'];
// Delete message
$res = sql_query("SELECT * FROM messages WHERE id=" . sqlesc($pm_id)) or sqlerr(__FILE__,__LINE__);
if (!$res)
{
stderr($lang_messages['std_error'],$lang_messages['std_no_message_id']);
}
if (mysql_num_rows($res) == 0)
{
stderr($lang_messages['std_error'],$lang_messages['std_no_message_id']);
}
$message = mysql_fetch_assoc($res);
if ($message['receiver'] == $CURUSER['id'] && $message['saved'] == 'no')
{
$res2 = sql_query("DELETE FROM messages WHERE id=" . sqlesc($pm_id)) or sqlerr(__FILE__,__LINE__);
}
elseif ($message['sender'] == $CURUSER['id'] && $message['location'] == PM_DELETED)
{
$res2 = sql_query("DELETE FROM messages WHERE id=" . sqlesc($pm_id)) or sqlerr(__FILE__,__LINE__);
}
elseif ($message['receiver'] == $CURUSER['id'] && $message['saved'] == 'yes')
{
$res2 = sql_query("UPDATE messages SET location=0 WHERE id=" . sqlesc($pm_id)) or sqlerr(__FILE__,__LINE__);
}
elseif ($message['sender'] == $CURUSER['id'] && $message['location'] != PM_DELETED)
{
$res2 = sql_query("UPDATE messages SET saved='no' WHERE id=" . sqlesc($pm_id)) or sqlerr(__FILE__,__LINE__);
}
if (!$res2)
{
stderr($lang_messages['std_error'],$lang_messages['std_could_not_delete_message']);
}
if (mysql_affected_rows() == 0)
{
stderr($lang_messages['std_error'],$lang_messages['std_could_not_delete_message']);
}
else
{
header("Location: messages.php?action=viewmailbox&id=" . $message['location']);
exit();
}
}
//----- FUNCTIONS ------
function insertJumpTo($selected = 0)
{
global $lang_messages;
global $CURUSER;
$res = sql_query('SELECT * FROM pmboxes WHERE userid=' . sqlesc($CURUSER['id']) . ' ORDER BY boxnumber');
$place = $_GET['place'] ?? '';
?>
<form action="messages.php" method="get">
<input type="hidden" name="action" value="viewmailbox"><?php echo $lang_messages['text_search'] ?>&nbsp;&nbsp;<input id="searchinput" name="keyword" type="text" value="<?php echo $_GET['keyword'] ?? ''?>" style="width: 200px"/>
<?php echo $lang_messages['text_in'] ?>&nbsp;<select name="place">
<option value="both" <?php echo ($place == 'both' ? " selected" : "")?>><?php echo $lang_messages['select_both'] ?></option>
<option value="title" <?php echo ($place == 'title' ? " selected" : "")?>><?php echo $lang_messages['select_title'] ?></option>
<option value="body" <?php echo ($place == 'body' ? " selected" : "")?>><?php echo $lang_messages['select_body'] ?></option>
</select>
<?php echo $lang_messages['text_jump_to'] ?><select name="box">
<option value="1" <?php echo ($selected == PM_INBOX ? " selected" : "")?>><?php echo $lang_messages['select_inbox'] ?></option>
<option value="-1" <?php echo ($selected == PM_SENTBOX ? " selected" : "")?>><?php echo $lang_messages['select_sentbox'] ?></option>
<?php
while ($row = mysql_fetch_assoc($res))
{
if ($row['boxnumber'] == $selected)
{
echo("<option value=\"" . $row['boxnumber'] . "\" selected>" . $row['name'] . "</option>\n");
}
else
{
echo("<option value=\"" . $row['boxnumber'] . "\">" . $row['name'] . "</option>\n");
}
}
?>
</select> <input class=btn type="submit" value=<?php echo $lang_messages['submit_go'] ?>></form>
<?php
}
function messagemenu ($selected = 1) {
global $lang_messages;
global $BASEURL;
global $CURUSER;
begin_main_frame();
print ("<div id=\"pmboxnav\"><ul id=\"pmboxmenu\" class=\"menu\">");
print ("<li" . ($selected == 1 ? " class=selected" : "") . "><a href=\"" . get_protocol_prefix() . $BASEURL . "/messages.php\" >".$lang_messages['text_inbox']."</a></li>");
print ("<li" . ($selected == -1 ? " class=selected" : "") . "><a href=\"" . get_protocol_prefix() . $BASEURL . "/messages.php?action=viewmailbox&box=-1\">".$lang_messages['text_sentbox']."</a></li>");
$res = sql_query('SELECT * FROM pmboxes WHERE userid=' . sqlesc($CURUSER['id'])) or sqlerr(__FILE__,__LINE__);
if (mysql_num_rows($res))
while ($row = mysql_fetch_assoc($res))
{
print ("<li" . ($selected == $row['boxnumber'] ? " class=selected" : "") . "><a href=\"" . get_protocol_prefix() . $BASEURL . "/messages.php?action=viewmailbox&box=".$row['boxnumber']."\">".$row['name']."</a></li>");
}
print ("</ul></div>");
end_main_frame();
}
?>
+100
View File
@@ -0,0 +1,100 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
loggedinorreturn();
if (get_user_class() < UC_ADMINISTRATOR) {
stderr("Error","Only Administrators and above can modify the Rules, sorry.");
}
if (isset($_GET["act"]) && $_GET["act"] == "newsect")
{
stdhead("Add section");
//print("<td valign=top style=\"padding: 10px;\" colspan=2 align=center>");
//begin_main_frame();
print("<h1 align=center>Add Rules</h1>");
print("<form method=\"post\" action=\"modrules.php?act=addsect\">");
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"10\" align=\"center\">\n");
print("<tr><td>Title:</td><td align=left><input style=\"width: 400px;\" type=\"text\" name=\"title\"/></td></tr>\n");
print("<tr><td style=\"vertical-align: top;\">Rules:</td><td><textarea cols=90 rows=20 name=\"text\"></textarea></td></tr>\n");
$s = "<select name=language>";
$langs = langlist("rule_lang");
foreach ($langs as $row)
{
if($row["site_lang_folder"] == $deflang) $se = " selected"; else $se = "";
$s .= "<option value=". $row["id"] . $se. ">" . htmlspecialchars($row["lang_name"]) . "</option>\n";
}
$s .= "</select>";
print("<tr><td>Language:</td><td align=\"center\">".$s."</td></tr>\n");
print("<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Add\" style=\"width: 60px;\"></td></tr>\n");
print("</table></form>");
print("</td></tr></table>");
stdfoot();
}
elseif (isset($_GET["act"]) && $_GET["act"]=="addsect"){
$title = $_POST["title"];
$text = $_POST["text"];
$language = $_POST["language"];
sql_query("insert into rules (title, text, lang_id) values(".sqlesc($title).", ".sqlesc($text).", ".sqlesc($language).")") or sqlerr(__FILE__,__LINE__);
header("Refresh: 0; url=modrules.php");
}
elseif (isset($_GET["act"]) && $_GET["act"] == "edit"){
$id = $_GET["id"];
$res = @mysql_fetch_array(@sql_query("select * from rules where id='$id'"));
stdhead("Edit rules");
//print("<td valign=top style=\"padding: 10px;\" colspan=2 align=center>");
//begin_main_frame();
print("<h1 align=center>Edit Rules</h1>");
print("<form method=\"post\" action=\"modrules.php?act=edited\">");
print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"10\" align=\"center\">\n");
print("<tr><td>Title:</td><td align=left><input style=\"width: 400px;\" type=\"text\" name=\"title\" value=\"".htmlspecialchars($res['title'])."\" /></td></tr>\n");
print("<tr><td style=\"vertical-align: top;\">Rules:</td><td><textarea cols=90 rows=20 name=\"text\">{$res['text']}</textarea></td></tr>\n");
$s = "<select name=language>";
$langs = langlist("site_lang");
foreach ($langs as $row)
{
if ($row['id'] == $res['lang_id']) $se = " selected"; else $se = "";
$s .= "<option value=". $row["id"] . $se. ">" . htmlspecialchars($row["lang_name"]) . "</option>\n";
}
$s .= "</select>";
print("<tr><td>Language:</td><td align=\"center\">".$s."</td></tr>\n");
print("<tr><td colspan=\"2\" align=\"center\"><input type=hidden value=$res[id] name=id><input type=\"submit\" value=\"Save\" style=\"width: 60px;\"></td></tr>\n");
print("</table>");
print("</td></tr></table>");
stdfoot();
}
elseif (isset($_GET["act"]) && $_GET["act"]=="edited"){
$id = intval($_POST["id"] ?? 0);
$title = $_POST["title"];
$text = $_POST["text"];
$language = $_POST["language"];
sql_query("update rules set title=".sqlesc($title).", text=".sqlesc($text).", lang_id = ".sqlesc($language)." where id=".sqlesc($id)) or sqlerr(__FILE__,__LINE__);
header("Refresh: 0; url=modrules.php");
}
elseif (isset($_GET["act"]) && $_GET["act"]=="del"){
$id = (int)$_GET["id"];
$sure = intval($_GET["sure"] ?? 0);
if (!$sure)
{
stderr("Delete Rule","You are about to delete a rule. Click <a class=altlink href=?act=del&id=$id&sure=1>here</a> if you are sure.",false);
}
sql_query("DELETE FROM rules WHERE id=".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
header("Refresh: 0; url=modrules.php");
}
else{
$res = sql_query("select rules.*, lang_name from rules left join language on rules.lang_id = language.id order by lang_name, id");
stdhead("Rules Manangement");
//print("<td valign=top style=\"padding: 10px;\" colspan=2 align=center>");
print("<h1 align=center>Rules Manangement</h1>");
print("<br /><table width=940 border=0 cellspacing=0 cellpadding=5>");
print("<tr><td align=center><a href=modrules.php?act=newsect>Add Section</a></td></tr></table>\n");
while ($arr=mysql_fetch_assoc($res)){
print("<br /><table width=940 border=1 cellspacing=0 cellpadding=5>");
print("<tr><td class=colhead>$arr[title] - $arr[lang_name]</td></tr>\n");
print("<tr><td align=left>" . format_comment($arr["text"])."</td></tr>");
print("<tr><td align=left><a href=?act=edit&id=$arr[id]>Edit</a>&nbsp;&nbsp;<a href=?act=del&id=$arr[id]>Delete</a></td></tr></table>");
//end_main_frame();
}
//print("");
print("</td></tr></table>");
stdfoot();
}
+342
View File
@@ -0,0 +1,342 @@
<?php
require "../include/bittorrent.php";
dbconn();
require(get_langfile_path("",true));
loggedinorreturn();
function puke()
{
$msg = "User ".$CURUSER["username"]." (id: ".$CURUSER["id"].") is hacking user's profile. IP : ".getip();
write_log($msg,'mod');
stderr("Error", "Permission denied. For security reason, we logged this action");
}
if (get_user_class() < $prfmanage_class)
puke();
$action = $_POST["action"];
if ($action == "confirmuser")
{
$userid = $_POST["userid"];
$confirm = $_POST["confirm"];
sql_query('UPDATE `users` SET `status` = \''.mysql_real_escape_string($confirm).'\', `info` = NULL WHERE `id` = '.mysql_real_escape_string($userid).' LIMIT 1;') or sqlerr(__FILE__, __LINE__);
header("Location: " . get_protocol_prefix() . "$BASEURL/unco.php?status=1");
die;
}
if ($action == "edituser")
{
$userid = $_POST["userid"];
$class = intval($_POST["class"] ?? 0);
$vip_added = ($_POST["vip_added"] == 'yes' ? 'yes' : 'no');
$vip_until = ($_POST["vip_until"] ? $_POST["vip_until"] : '0000-00-00 00:00:00');
$warned = $_POST["warned"];
$warnlength = intval($_POST["warnlength"] ?? 0);
$warnpm = $_POST["warnpm"];
$title = $_POST["title"];
$avatar = $_POST["avatar"];
$signature = $_POST["signature"];
$enabled = $_POST["enabled"];
$uploadpos = $_POST["uploadpos"];
$downloadpos = $_POST["downloadpos"];
$noad = $_POST["noad"];
$noaduntil = $_POST["noaduntil"];
$privacy = $_POST["privacy"];
$forumpost = $_POST["forumpost"];
$chpassword = $_POST["chpassword"];
$passagain = $_POST["passagain"];
$supportlang = $_POST["supportlang"];
$support = $_POST["support"];
$supportfor = $_POST["supportfor"];
$moviepicker = $_POST["moviepicker"];
$pickfor = $_POST["pickfor"];
$stafffor = $_POST["staffduties"];
if (!is_valid_id($userid) || !is_valid_user_class($class))
stderr("Error", "Bad user ID or class ID.");
if (get_user_class() <= $class)
stderr("Error", "You have no permission to change user's class to ".get_user_class_name($class,false,false,true).". BTW, how do you get here?");
$res = sql_query("SELECT * FROM users WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
$arr = mysql_fetch_assoc($res) or puke();
$curenabled = $arr["enabled"];
$curparked = $arr["parked"];
$curuploadpos = $arr["uploadpos"];
$curdownloadpos = $arr["downloadpos"];
$curforumpost = $arr["forumpost"];
$curclass = $arr["class"];
$curwarned = $arr["warned"];
$updateset[] = "stafffor = " . sqlesc($stafffor);
$updateset[] = "pickfor = " . sqlesc($pickfor);
$updateset[] = "picker = " . sqlesc($moviepicker);
$updateset[] = "enabled = " . sqlesc($enabled);
$updateset[] = "uploadpos = " . sqlesc($uploadpos);
$updateset[] = "downloadpos = " . sqlesc($downloadpos);
$updateset[] = "forumpost = " . sqlesc($forumpost);
$updateset[] = "avatar = " . sqlesc($avatar);
$updateset[] = "signature = " . sqlesc($signature);
$updateset[] = "title = " . sqlesc($title);
$updateset[] = "support = " . sqlesc($support);
$updateset[] = "supportfor = " . sqlesc($supportfor);
$updateset[] = "supportlang = ".sqlesc($supportlang);
if(get_user_class<=$cruprfmanage_class)
{
$modcomment = $arr["modcomment"];
}
if(get_user_class() >= $cruprfmanage_class)
{
$email = $_POST["email"];
$username = $_POST["username"];
$modcomment = $_POST["modcomment"];
$downloaded = $_POST["downloaded"];
$ori_downloaded = $_POST["ori_downloaded"];
$uploaded = $_POST["uploaded"];
$ori_uploaded = $_POST["ori_uploaded"];
$bonus = $_POST["bonus"];
$ori_bonus = $_POST["ori_bonus"];
$invites = $_POST["invites"];
$added = sqlesc(date("Y-m-d H:i:s"));
if ($arr['email'] != $email){
$updateset[] = "email = " . sqlesc($email);
$modcomment = date("Y-m-d") . " - Email changed from $arr[email] to $email by $CURUSER[username].\n". $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_email_change']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_email_changed_from'].$arr['email'].$lang_modtask_target[get_user_lang($userid)]['msg_to_new'] . $email .$lang_modtask_target[get_user_lang($userid)]['msg_by'].$CURUSER[username]);
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
if ($arr['username'] != $username){
$updateset[] = "username = " . sqlesc($username);
$modcomment = date("Y-m-d") . " - Usernmae changed from $arr[username] to $username by $CURUSER[username].\n". $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_username_change']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_username_changed_from'].$arr['username'].$lang_modtask_target[get_user_lang($userid)]['msg_to_new'] . $username .$lang_modtask_target[get_user_lang($userid)]['msg_by'].$CURUSER[username]);
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
if ($ori_downloaded != $downloaded){
$updateset[] = "downloaded = " . sqlesc($downloaded);
$modcomment = date("Y-m-d") . " - Downloaded amount changed from $arr[downloaded] to $downloaded by $CURUSER[username].\n". $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_downloaded_change']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_downloaded_changed_from'].mksize($arr['downloaded']).$lang_modtask_target[get_user_lang($userid)]['msg_to_new'] . mksize($downloaded) .$lang_modtask_target[get_user_lang($userid)]['msg_by'].$CURUSER[username]);
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
if ($ori_uploaded != $uploaded){
$updateset[] = "uploaded = " . sqlesc($uploaded);
$modcomment = date("Y-m-d") . " - Uploaded amount changed from $arr[uploaded] to $uploaded by $CURUSER[username].\n". $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_uploaded_change']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_uploaded_changed_from'].mksize($arr['uploaded']).$lang_modtask_target[get_user_lang($userid)]['msg_to_new'] . mksize($uploaded) .$lang_modtask_target[get_user_lang($userid)]['msg_by'].$CURUSER[username]);
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
if ($ori_bonus != $bonus){
$updateset[] = "seedbonus = " . sqlesc($bonus);
$modcomment = date("Y-m-d") . " - Bonus amount changed from $arr[seedbonus] to $bonus by $CURUSER[username].\n". $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_bonus_change']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_bonus_changed_from'].$arr['seedbonus'].$lang_modtask_target[get_user_lang($userid)]['msg_to_new'] . $bonus .$lang_modtask_target[get_user_lang($userid)]['msg_by'].$CURUSER[username]);
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
if ($arr['invites'] != $invites){
$updateset[] = "invites = " . sqlesc($invites);
$modcomment = date("Y-m-d") . " - Invite amount changed from $arr[invites] to $invites by $CURUSER[username].\n". $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_invite_change']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_invite_changed_from'].$arr['invites'].$lang_modtask_target[get_user_lang($userid)]['msg_to_new'] . $invites .$lang_modtask_target[get_user_lang($userid)]['msg_by'].$CURUSER[username]);
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
}
if(get_user_class() == UC_STAFFLEADER)
{
$donor = $_POST["donor"];
$donated = $_POST["donated"];
$donated_cny = $_POST["donated_cny"];
$this_donated_usd = $donated - $arr["donated"];
$this_donated_cny = $donated_cny - $arr["donated_cny"];
$memo = sqlesc(htmlspecialchars($_POST["donation_memo"]));
if ($donated != $arr[donated] || $donated_cny != $arr[donated_cny]) {
$added = sqlesc(date("Y-m-d H:i:s"));
sql_query("INSERT INTO funds (usd, cny, user, added, memo) VALUES ($this_donated_usd, $this_donated_cny, $userid, $added, $memo)") or sqlerr(__FILE__, __LINE__);
$updateset[] = "donated = " . sqlesc($donated);
$updateset[] = "donated_cny = " . sqlesc($donated_cny);
}
$updateset[] = "donor = " . sqlesc($donor);
}
if ($chpassword != "" AND $passagain != "") {
unset($passupdate);
$passupdate=false;
if ($chpassword == $username OR strlen($chpassword) > 40 OR strlen($chpassword) < 6 OR $chpassword != $passagain)
$passupdate=false;
else
$passupdate=true;
}
if ($passupdate) {
$sec = mksecret();
$passhash = md5($sec . $chpassword . $sec);
$updateset[] = "secret = " . sqlesc($sec);
$updateset[] = "passhash = " . sqlesc($passhash);
}
if ($curclass >= get_user_class())
puke();
if ($curclass != $class)
{
$what = ($class > $curclass ? $lang_modtask_target[get_user_lang($userid)]['msg_promoted'] : $lang_modtask_target[get_user_lang($userid)]['msg_demoted']);
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_class_change']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_you_have_been'].$what.$lang_modtask_target[get_user_lang($userid)]['msg_to'] . get_user_class_name($class) .$lang_modtask_target[get_user_lang($userid)]['msg_by'].$CURUSER[username]);
$added = sqlesc(date("Y-m-d H:i:s"));
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
$updateset[] = "class = $class";
$what = ($class > $curclass ? "Promoted" : "Demoted");
$modcomment = date("Y-m-d") . " - $what to '" . get_user_class_name($class) . "' by $CURUSER[username].\n". $modcomment;
}
if ($class == UC_VIP)
{
$updateset[] = "vip_added = ".sqlesc($vip_added);
if ($vip_added == 'yes')
$updateset[] = "vip_until = ".sqlesc($vip_until);
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_vip_status_changed']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_vip_status_changed_by'].$CURUSER[username]);
$added = sqlesc(date("Y-m-d H:i:s"));
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
$modcomment = date("Y-m-d") . " - VIP status changed by $CURUSER[username]. VIP added: ".$vip_added.($vip_added == 'yes' ? "; VIP until: ".$vip_until : "").".\n". $modcomment;
}
if ($warned && $curwarned != $warned)
{
$updateset[] = "warned = " . sqlesc($warned);
$updateset[] = "warneduntil = '0000-00-00 00:00:00'";
if ($warned == 'no')
{
$modcomment = date("Y-m-d") . " - Warning removed by $CURUSER[username].\n". $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_warn_removed']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_warning_removed_by'] . $CURUSER['username'] . ".");
}
$added = sqlesc(date("Y-m-d H:i:s"));
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
elseif ($warnlength)
{
if ($warnlength == 255)
{
$modcomment = date("Y-m-d") . " - Warned by " . $CURUSER['username'] . ".\nReason: $warnpm.\n". $modcomment;
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_you_are_warned_by'].$CURUSER[username]."." . ($warnpm ? $lang_modtask_target[get_user_lang($userid)]['msg_reason'].$warnpm : ""));
$updateset[] = "warneduntil = '0000-00-00 00:00:00'";
}else{
$warneduntil = date("Y-m-d H:i:s",(strtotime(date("Y-m-d H:i:s")) + $warnlength * 604800));
$dur = $warnlength . $lang_modtask_target[get_user_lang($userid)]['msg_week'] . ($warnlength > 1 ? $lang_modtask_target[get_user_lang($userid)]['msg_s'] : "");
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_you_are_warned_for'].$dur.$lang_modtask_target[get_user_lang($userid)]['msg_by'] . $CURUSER['username'] . "." . ($warnpm ? $lang_modtask_target[get_user_lang($userid)]['msg_reason'].$warnpm : ""));
$modcomment = date("Y-m-d") . " - Warned for $dur by " . $CURUSER['username'] . ".\nReason: $warnpm.\n". $modcomment;
$updateset[] = "warneduntil = '$warneduntil'";
}
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_you_are_warned']);
$added = sqlesc(date("Y-m-d H:i:s"));
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
$updateset[] = "warned = 'yes', timeswarned = timeswarned+1, lastwarned=$added, warnedby=$CURUSER[id]";
}
if ($enabled != $curenabled)
{
if ($enabled == 'yes') {
$modcomment = date("Y-m-d") . " - Enabled by " . $CURUSER['username']. ".\n". $modcomment;
if (get_single_value("users","class","WHERE id = ".sqlesc($userid)) == UC_PEASANT){
$length = 30*86400; // warn users until 30 days
$until = sqlesc(date("Y-m-d H:i:s",(strtotime(date("Y-m-d H:i:s")) + $length)));
sql_query("UPDATE users SET enabled='yes', leechwarn='yes', leechwarnuntil=$until WHERE id = ".sqlesc($userid));
}
else{
sql_query("UPDATE users SET enabled='yes', leechwarn='no' WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
}
} else {
$modcomment = date("Y-m-d") . " - Disabled by " . $CURUSER['username']. ".\n". $modcomment;
}
}
if ($arr['noad'] != $noad){
$updateset[]='noad = '.sqlesc($noad);
$modcomment = date("Y-m-d") . " - No Ad set to ".$noad." by ". $CURUSER['username']. ".\n". $modcomment;
}
if ($arr['noaduntil'] != $noaduntil){
$updateset[]='noaduntil = '.sqlesc($noaduntil);
$modcomment = date("Y-m-d") . " - No Ad Until set to ".$noaduntil." by ". $CURUSER['username']. ".\n". $modcomment;
}
if ($privacy == "low" OR $privacy == "normal" OR $privacy == "strong")
$updateset[] = "privacy = " . sqlesc($privacy);
if ($_POST["resetkey"] == "yes")
{
$newpasskey = md5($arr['username'].date("Y-m-d H:i:s").$arr['passhash']);
$updateset[] = "passkey = ".sqlesc($newpasskey);
}
if ($forumpost != $curforumpost)
{
if ($forumpost == 'yes')
{
$modcomment = date("Y-m-d") . " - Posting enabled by " . $CURUSER['username'] . ".\n" . $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_posting_rights_restored']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_posting_rights_restored']. $CURUSER['username'] . $lang_modtask_target[get_user_lang($userid)]['msg_you_can_post']);
$added = sqlesc(date("Y-m-d H:i:s"));
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
else
{
$modcomment = date("Y-m-d") . " - Posting disabled by " . $CURUSER['username'] . ".\n" . $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_posting_rights_removed']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_posting_rights_removed'] . $CURUSER['username'] . $lang_modtask_target[get_user_lang($userid)]['msg_probable_reason']);
$added = sqlesc(date("Y-m-d H:i:s"));
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
}
if ($uploadpos != $curuploadpos)
{
if ($uploadpos == 'yes')
{
$modcomment = date("Y-m-d") . " - Upload enabled by " . $CURUSER['username'] . ".\n" . $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_upload_rights_restored']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_upload_rights_restored'] . $CURUSER['username'] . $lang_modtask_target[get_user_lang($userid)]['msg_you_upload_can_upload']);
$added = sqlesc(date("Y-m-d H:i:s"));
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
else
{
$modcomment = date("Y-m-d") . " - Upload disabled by " . $CURUSER['username'] . ".\n" . $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_upload_rights_removed']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_upload_rights_removed'] . $CURUSER['username'] . $lang_modtask_target[get_user_lang($userid)]['msg_probably_reason_two']);
$added = sqlesc(date("Y-m-d H:i:s"));
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
}
if ($downloadpos != $curdownloadpos)
{
if ($downloadpos == 'yes')
{
$modcomment = date("Y-m-d") . " - Download enabled by " . $CURUSER['username'] . ".\n" . $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_download_rights_restored']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_download_rights_restored']. $CURUSER['username'] . $lang_modtask_target[get_user_lang($userid)]['msg_you_can_download']);
$added = sqlesc(date("Y-m-d H:i:s"));
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
else
{
$modcomment = date("Y-m-d") . " - Download disabled by " . $CURUSER['username'] . ".\n" . $modcomment;
$subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_download_rights_removed']);
$msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_download_rights_removed'] . $CURUSER['username'] . $lang_modtask_target[get_user_lang($userid)]['msg_probably_reason_three']);
$added = sqlesc(date("Y-m-d H:i:s"));
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
}
$updateset[] = "modcomment = " . sqlesc($modcomment);
sql_query("UPDATE users SET " . implode(", ", $updateset) . " WHERE id=$userid") or sqlerr(__FILE__, __LINE__);
$returnto = htmlspecialchars($_POST["returnto"]);
header("Location: " . get_protocol_prefix() . "$BASEURL/$returnto");
die;
}
puke();
?>
+219
View File
@@ -0,0 +1,219 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
if (get_user_class() < $forummanage_class)
permissiondenied();
//Presets
$act = $_GET['action'] ?? '';
$id = intval($_GET['id'] ?? 0);
$PHP_SELF = $_SERVER['PHP_SELF'];
$user = $CURUSER;
$prefix = '';
if (!$act) {
$act = "forum";
}
// DELETE FORUM ACTION
if ($act == "del") {
if (get_user_class() < $forummanage_class)
permissiondenied();
if (!$id) { header("Location: $PHP_SELF?action=forum"); die();}
sql_query ("DELETE FROM overforums WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('overforums_list');
header("Location: $PHP_SELF?action=forum");
die();
}
//EDIT FORUM ACTION
if (isset($_POST['action']) && $_POST['action'] == "editforum") {
if (get_user_class() < $forummanage_class)
permissiondenied();
$name = $_POST['name'];
$desc = $_POST['desc'];
if (!$name && !$desc && !$id) { header("Location: $PHP_SELF?action=forum"); die();}
sql_query("UPDATE overforums SET sort = " . sqlesc($_POST['sort']) . ", name = " . sqlesc($_POST['name']). ", description = " . sqlesc($_POST['desc']). ", minclassview = " . sqlesc($_POST['viewclass']) . " WHERE id = ".sqlesc($_POST['id'])) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('overforums_list');
header("Location: $PHP_SELF?action=forum");
die();
}
//ADD FORUM ACTION
if (isset($_POST['action']) && $_POST['action'] == "addforum") {
if (get_user_class() < $forummanage_class)
permissiondenied();
$name = trim($_POST['name']);
$desc = trim($_POST['desc']);
if (!$name && !$desc)
{
header("Location: $PHP_SELF?action=forum");
die();
}
sql_query("INSERT INTO overforums (sort, name, description, minclassview) VALUES(" . sqlesc($_POST['sort']) . ", " . sqlesc($_POST['name']). ", " . sqlesc($_POST['desc']). ", " . sqlesc($_POST['viewclass']) . ")") or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('overforums_list');
header("Location: $PHP_SELF?action=forum");
die();
}
stdhead($lang_moforums['head_overforum_management']);
begin_main_frame();
if ($act == "forum")
{
// SHOW FORUMS WITH FORUM MANAGMENT TOOLS
?>
<h2 class=transparentbg align=center><a class=faqlink href=forummanage.php><?php echo $lang_moforums['text_forum_management']?></a><b>--></b><?php echo $lang_moforums['text_overforum_management']?></h2>
<br />
<?php
echo '<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">';
echo "<tr><td class=colhead align=left>".$lang_moforums['col_name']."</td><td class=colhead>".$lang_moforums['col_viewed_by']."</td><td class=colhead>".$lang_moforums['col_modify']."</td></tr>";
$result = sql_query ("SELECT * FROM overforums ORDER BY sort ASC");
if ($row = mysql_fetch_array($result)) {
do {
echo "<tr><td><a href=forums.php?action=forumview&forid=".$row["id"]."><b>".htmlspecialchars($row["name"])."</b></a><br />".$row["description"]."</td>";
echo "<td>" . get_user_class_name($row["minclassview"],false,true,true) . "</td><td><b><a href=\"".$PHP_SELF."?action=editforum&id=".$row["id"]."\">".$lang_moforums['text_edit']."</a>&nbsp;|&nbsp;<a href=\"javascript:confirm_delete('".$row["id"]."', '".$lang_moforums['js_sure_to_delete_overforum']."', '');\"><font color=red>".$lang_moforums['text_delete']."</font></a></b></td></tr>";
} while($row = mysql_fetch_array($result));
} else {print "<tr><td colspan=3>".$lang_moforums['text_no_records_found']."</td></tr>";}
echo "</table>";
?>
<br /><br />
<form method=post action="<?php echo $PHP_SELF;?>">
<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center">
<tr align="center">
<td colspan="2" class=colhead><?php echo $lang_moforums['text_new_overforum']?></td>
</tr>
<tr>
<td><b><?php echo $lang_moforums['text_overforum_name']?></td>
<td><input name="name" type="text" style="width: 200px" maxlength="60"></td>
</tr>
<tr>
<td><b><?php echo $lang_moforums['text_overforum_description']?></td>
<td><input name="desc" type="text" style="width: 400px" maxlength="200"></td>
</tr>
<tr>
<td><b><?php echo $lang_moforums['text_minimum_view_permission']?></td>
<td>
<select name=viewclass>\n
<?php
$maxclass = get_user_class();
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i" . ($user["class"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
?>
</select>
</td>
</tr>
<tr>
<td><b><?php echo $lang_moforums['text_overforum_order']?></td>
<td>
<select name=sort>
<?php
$res = sql_query ("SELECT sort FROM overforums");
$nr = mysql_num_rows($res);
$maxclass = $nr + 1;
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i>$i \n");
?>
</select>
<?php echo $lang_moforums['text_overforum_order_note']?></td>
</tr>
<tr align="center">
<td colspan="2"><input type="hidden" name="action" value="addforum"><input type="submit" name="Submit" value="<?php echo $lang_moforums['submit_make_overforum']?>"></td>
</tr>
</table>
<?php
}
?>
<?php if ($act == "editforum") {
//EDIT PAGE FOR THE FORUMS
$id = intval($_GET["id"] ?? 0);
$result = sql_query ("SELECT * FROM overforums where id = '$id'");
if ($row = mysql_fetch_array($result)) {
// Get OverForum Name - To Be Written
do {
?>
<h2 class=transparentbg align=center><a class=faqlink href=forummanage.php><?php echo $lang_moforums['text_forum_management']?></a><b>--></b><a class=faqlink href=moforums.php><?php echo $lang_moforums['text_overforum_management']?></a><b>--></b><?php echo $lang_moforums['text_edit_overforum']?></h2><br />
<form method=post action="<?php echo $PHP_SELF;?>">
<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center">
<tr align="center">
<td colspan="2" class=colhead><?php echo $lang_moforums['text_edit_overforum']?> -- <?php echo htmlspecialchars($row["name"]);?></td>
</tr>
<td><b><?php echo $lang_moforums['text_overforum_name']?></td>
<td><input name="name" type="text" style="width: 200px" maxlength="60" value="<?php echo $row["name"];?>"></td>
</tr>
<tr>
<td><b><?php echo $lang_moforums['text_overforum_description']?></td>
<td><input name="desc" type="text" style="width: 400px" maxlength="200" value="<?php echo $row["description"];?>"></td>
</tr>
<tr>
<td><b><?php echo $lang_moforums['text_minimum_view_permission']?></td>
<td>
<select name=viewclass>
<?php
$maxclass = get_user_class();
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i" . ($row["minclassview"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i,false,true,true) . "\n");
?>
</select>
</td>
</tr>
<tr>
<td><b><?php echo $lang_moforums['text_overforum_order']?></td>
<td>
<select name=sort>
<?php
$res = sql_query ("SELECT sort FROM overforums");
$nr = mysql_num_rows($res);
$maxclass = $nr + 1;
for ($i = 0; $i <= $maxclass; ++$i)
print("<option value=$i" . ($row["sort"] == $i ? " selected" : "") . ">$i \n");
?>
</select>
<?php echo $lang_moforums['text_overforum_order_note']?>
</td>
</tr>
<tr align="center">
<td colspan="2"><input type="hidden" name="action" value="editforum"><input type="hidden" name="id" value="<?php echo $id;?>"><input type="submit" name="Submit" value="<?php echo $lang_moforums['submit_edit_overforum']?>"></td>
</tr>
</table>
<?php
} while($row = mysql_fetch_array($result));
} else {print $lang_moforums['text_no_records_found'];}
}
end_main_frame();
stdfoot();
+45
View File
@@ -0,0 +1,45 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
parked();
?>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $lang_moresmilies['head_more_smilies']?></title>
<style type="text/css">
img {border: none;}
body {color: #000000; background-color: #ffffff}
</style>
</head>
<body>
<script type="text/javascript">
function SmileIT(smile,form,text){
window.opener.document.forms[form].elements[text].value = window.opener.document.forms[form].elements[text].value+" "+smile+" ";
window.opener.document.forms[form].elements[text].focus();
window.close();
}
</script>
<table class="lista" width="100%" cellpadding="1" cellspacing="1">
<?php
$count = 0;
for($i=1; $i<192; $i++) {
if ($count % 3==0)
print("\n<tr>");
print("\n\t<td class=\"lista\" align=\"center\"><a href=\"javascript: SmileIT('[em$i]','".$_GET["form"]."','".$_GET["text"]."')\"><img src=\"pic/smilies/$i.gif\" alt=\"\" ></a></td>");
$count++;
if ($count % 3==0)
print("\n</tr>");
}
?>
</table>
<div align="center">
<a href="javascript: window.close()"><?php echo $lang_moresmilies['text_close']?></a>
</div>
</body>
</html>
+105
View File
@@ -0,0 +1,105 @@
<?php
require "../include/bittorrent.php";
dbconn();
$userid = intval($_GET["userid"] ?? 0);
$bgpic = intval($_GET["bgpic"] ?? 0);
if (!$userid)
die;
if (!preg_match("/.*userid=([0-9]+)\.png$/i", $_SERVER['REQUEST_URI']))
die;
if (!$my_img = $Cache->get_value('userbar_'.$_SERVER['REQUEST_URI'])){
$res = sql_query("SELECT username, uploaded, downloaded, class, privacy FROM users WHERE id=".sqlesc($userid)." LIMIT 1");
$row = mysql_fetch_array($res);
if (!$row)
die;
elseif($row['privacy'] == 'strong')
die;
elseif($row['class'] < $userbar_class)
die;
else{
$username = $row['username'];
$uploaded = mksize($row['uploaded']);
$downloaded = mksize($row['downloaded']);
}
$my_img=imagecreatefrompng("pic/userbar/".$bgpic.".png");
imagealphablending($my_img, false);
if (!$_GET['noname'])
{
if (isset($_GET['namered']) && $_GET['namered']>=0 && $_GET['namered']<=255)
$namered = intval($_GET['namered'] ?? 0);
else $namered=255;
if (isset($_GET['namegreen']) && $_GET['namegreen']>=0 && $_GET['namegreen']<=255)
$namegreen = intval($_GET['namegreen'] ?? 0);
else $namegreen=255;
if (isset($_GET['nameblue']) && $_GET['nameblue']>=0 && $_GET['nameblue']<=255)
$nameblue = intval($_GET['nameblue'] ?? 0);
else $nameblue=255;
if (isset($_GET['namesize']) && $_GET['namesize']>=1 && $_GET['namesize']<=5)
$namesize = intval($_GET['namesize'] ?? 0);
else $namesize=3;
if (isset($_GET['namex']) && $_GET['namex']>=0 && $_GET['namex']<=350)
$namex = intval($_GET['namex'] ?? 0);
else $namex=10;
if (isset($_GET['namey']) && $_GET['namey']>=0 && $_GET['namey']<=19)
$namey = intval($_GET['namey'] ?? 0);
else $namey=3;
$name_colour = imagecolorallocate($my_img, $namered, $namegreen, $nameblue);
imagestring($my_img, $namesize, $namex, $namey, $username, $name_colour);
}
if (!$_GET['noup'])
{
if (isset($_GET['upred']) && $_GET['upred']>=0 && $_GET['upred']<=255)
$upred = intval($_GET['upred'] ?? 0);
else $upred=0;
if (isset($_GET['upgreen']) && $_GET['upgreen']>=0 && $_GET['upgreen']<=255)
$upgreen = intval($_GET['upgreen'] ?? 0);
else $upgreen=255;
if (isset($_GET['upblue']) && $_GET['upblue']>=0 && $_GET['upblue']<=255)
$upblue = intval($_GET['upblue'] ?? 0);
else $upblue=0;
if (isset($_GET['upsize']) && $_GET['upsize']>=1 && $_GET['upsize']<=5)
$upsize = intval($_GET['upsize'] ?? 0);
else $upsize=3;
if (isset($_GET['upx']) && $_GET['upx']>=0 && $_GET['upx']<=350)
$upx = intval($_GET['upx'] ?? 0);
else $upx=100;
if (isset($_GET['upy']) && $_GET['upy']>=0 && $_GET['upy']<=19)
$upy = intval($_GET['upy'] ?? 0);
else $upy=3;
$up_colour = imagecolorallocate($my_img, $upred, $upgreen, $upblue);
imagestring($my_img, $upsize, $upx, $upy, $uploaded, $up_colour);
}
if (!$_GET['nodown'])
{
if (isset($_GET['downred']) && $_GET['downred']>=0 && $_GET['downred']<=255)
$downred = intval($_GET['downred'] ?? 0);
else $downred=255;
if (isset($_GET['downgreen']) && $_GET['downgreen']>=0 && $_GET['downgreen']<=255)
$downgreen = intval($_GET['downgreen'] ?? 0);
else $downgreen=0;
if (isset($_GET['downblue']) && $_GET['downblue']>=0 && $_GET['downblue']<=255)
$downblue = intval($_GET['downblue'] ?? 0);
else $downblue=0;
if (isset($_GET['downsize']) && $_GET['downsize']>=1 && $_GET['downsize']<=5)
$downsize = intval($_GET['downsize'] ?? 0);
else $downsize=3;
if (isset($_GET['downx']) && $_GET['downx']>=0 && $_GET['downx']<=350)
$downx = intval($_GET['downx'] ?? 0);
else $downx=180;
if (isset($_GET['downy']) && $_GET['downy']>=0 && $_GET['downy']<=19)
$downy = $_GET['downy'];
else $downy=3;
$down_colour = imagecolorallocate($my_img, $downred, $downgreen, $downblue);
imagestring($my_img, $downsize, $downx, $downy, $downloaded, $down_colour);
}
imagesavealpha($my_img, true);
$Cache->cache_value('userbar_'.$_SERVER['REQUEST_URI'], $my_img, 300);
}
header("Content-type: image/png");
imagepng($my_img);
imagedestroy($my_img);
?>
+479
View File
@@ -0,0 +1,479 @@
<?php
require_once('include/bittorrent.php');
dbconn();
require_once(get_langfile_path());
require(get_langfile_path("",true));
loggedinorreturn();
parked();
function bonusarray($option){
global $onegbupload_bonus,$fivegbupload_bonus,$tengbupload_bonus,$oneinvite_bonus,$customtitle_bonus,$vipstatus_bonus, $basictax_bonus, $taxpercentage_bonus, $bonusnoadpoint_advertisement, $bonusnoadtime_advertisement;
global $lang_mybonus;
$bonus = array();
switch ($option)
{
case 1: {//1.0 GB Uploaded
$bonus['points'] = $onegbupload_bonus;
$bonus['art'] = 'traffic';
$bonus['menge'] = 1073741824;
$bonus['name'] = $lang_mybonus['text_uploaded_one'];
$bonus['description'] = $lang_mybonus['text_uploaded_note'];
break;
}
case 2: {//5.0 GB Uploaded
$bonus['points'] = $fivegbupload_bonus;
$bonus['art'] = 'traffic';
$bonus['menge'] = 5368709120;
$bonus['name'] = $lang_mybonus['text_uploaded_two'];
$bonus['description'] = $lang_mybonus['text_uploaded_note'];
break;
}
case 3: {//10.0 GB Uploaded
$bonus['points'] = $tengbupload_bonus;
$bonus['art'] = 'traffic';
$bonus['menge'] = 10737418240;
$bonus['name'] = $lang_mybonus['text_uploaded_three'];
$bonus['description'] = $lang_mybonus['text_uploaded_note'];
break;
}
case 4: {//Invite
$bonus['points'] = $oneinvite_bonus;
$bonus['art'] = 'invite';
$bonus['menge'] = 1;
$bonus['name'] = $lang_mybonus['text_buy_invite'];
$bonus['description'] = $lang_mybonus['text_buy_invite_note'];
break;
}
case 5: {//Custom Title
$bonus['points'] = $customtitle_bonus;
$bonus['art'] = 'title';
$bonus['menge'] = 0;
$bonus['name'] = $lang_mybonus['text_custom_title'];
$bonus['description'] = $lang_mybonus['text_custom_title_note'];
break;
}
case 6: {//VIP Status
$bonus['points'] = $vipstatus_bonus;
$bonus['art'] = 'class';
$bonus['menge'] = 0;
$bonus['name'] = $lang_mybonus['text_vip_status'];
$bonus['description'] = $lang_mybonus['text_vip_status_note'];
break;
}
case 7: {//Bonus Gift
$bonus['points'] = 25;
$bonus['art'] = 'gift_1';
$bonus['menge'] = 0;
$bonus['name'] = $lang_mybonus['text_bonus_gift'];
$bonus['description'] = $lang_mybonus['text_bonus_gift_note'];
if ($basictax_bonus || $taxpercentage_bonus){
$onehundredaftertax = 100 - $taxpercentage_bonus - $basictax_bonus;
$bonus['description'] .= "<br /><br />".$lang_mybonus['text_system_charges_receiver']."<b>".($basictax_bonus ? $basictax_bonus.$lang_mybonus['text_tax_bonus_point'].add_s($basictax_bonus).($taxpercentage_bonus ? $lang_mybonus['text_tax_plus'] : "") : "").($taxpercentage_bonus ? $taxpercentage_bonus.$lang_mybonus['text_percent_of_transfered_amount'] : "")."</b>".$lang_mybonus['text_as_tax'].$onehundredaftertax.$lang_mybonus['text_tax_example_note'];
}
break;
}
case 8: {
$bonus['points'] = $bonusnoadpoint_advertisement;
$bonus['art'] = 'noad';
$bonus['menge'] = $bonusnoadtime_advertisement * 86400;
$bonus['name'] = $bonusnoadtime_advertisement.$lang_mybonus['text_no_advertisements'];
$bonus['description'] = $lang_mybonus['text_no_advertisements_note'];
break;
}
case 9: {
$bonus['points'] = 1000;
$bonus['art'] = 'gift_2';
$bonus['menge'] = 0;
$bonus['name'] = $lang_mybonus['text_charity_giving'];
$bonus['description'] = $lang_mybonus['text_charity_giving_note'];
break;
}
default: break;
}
return $bonus;
}
if ($bonus_tweak == "disable" || $bonus_tweak == "disablesave")
stderr($lang_mybonus['std_sorry'],$lang_mybonus['std_karma_system_disabled'].($bonus_tweak == "disablesave" ? "<b>".$lang_mybonus['std_points_active']."</b>" : ""),false);
$action = htmlspecialchars($_GET['action'] ?? '');
$do = htmlspecialchars($_GET['do'] ?? null);
unset($msg);
if (isset($do)) {
if ($do == "upload")
$msg = $lang_mybonus['text_success_upload'];
elseif ($do == "invite")
$msg = $lang_mybonus['text_success_invites'];
elseif ($do == "vip")
$msg = $lang_mybonus['text_success_vip']."<b>".get_user_class_name(UC_VIP,false,false,true)."</b>".$lang_mybonus['text_success_vip_two'];
elseif ($do == "vipfalse")
$msg = $lang_mybonus['text_no_permission'];
elseif ($do == "title")
$msg = $lang_mybonus['text_success_custom_title'];
elseif ($do == "transfer")
$msg = $lang_mybonus['text_success_gift'];
elseif ($do == "noad")
$msg = $lang_mybonus['text_success_no_ad'];
elseif ($do == "charity")
$msg = $lang_mybonus['text_success_charity'];
else
$msg = '';
}
stdhead($CURUSER['username'] . $lang_mybonus['head_karma_page']);
$bonus = number_format($CURUSER['seedbonus'], 1);
if (!$action) {
print("<table align=\"center\" width=\"940\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n");
print("<tr><td class=\"colhead\" colspan=\"4\" align=\"center\"><font class=\"big\">".$SITENAME.$lang_mybonus['text_karma_system']."</font></td></tr>\n");
if ($msg)
print("<tr><td align=\"center\" colspan=\"4\"><font class=\"striking\">". $msg ."</font></td></tr>");
?>
<tr><td class="text" align="center" colspan="4"><?php echo $lang_mybonus['text_exchange_your_karma']?><?php echo $bonus?><?php echo $lang_mybonus['text_for_goodies'] ?>
<br /><b><?php echo $lang_mybonus['text_no_buttons_note'] ?></b></td></tr>
<?php
print("<tr><td class=\"colhead\" align=\"center\">".$lang_mybonus['col_option']."</td>".
"<td class=\"colhead\" align=\"left\">".$lang_mybonus['col_description']."</td>".
"<td class=\"colhead\" align=\"center\">".$lang_mybonus['col_points']."</td>".
"<td class=\"colhead\" align=\"center\">".$lang_mybonus['col_trade']."</td>".
"</tr>");
for ($i=1; $i <=9; $i++)
{
$bonusarray = bonusarray($i);
if (($i == 7 && $bonusgift_bonus == 'no') || ($i == 8 && ($enablead_advertisement == 'no' || $bonusnoad_advertisement == 'no')))
continue;
print("<tr>");
print("<form action=\"?action=exchange\" method=\"post\">");
print("<td class=\"rowhead_center\"><input type=\"hidden\" name=\"option\" value=\"".$i."\" /><b>".$i."</b></td>");
if ($i==5){ //for Custom Title!
$otheroption_title = "<input type=\"text\" name=\"title\" style=\"width: 200px\" maxlength=\"30\" />";
print("<td class=\"rowfollow\" align='left'><h1>".$bonusarray['name']."</h1>".$bonusarray['description']."<br /><br />".$lang_mybonus['text_enter_titile'].$otheroption_title.$lang_mybonus['text_click_exchange']."</td><td class=\"rowfollow\" align='center'>".number_format($bonusarray['points'])."</td>");
}
elseif ($i==7){ //for Give A Karma Gift
$otheroption = "<table width=\"100%\"><tr><td class=\"embedded\"><b>".$lang_mybonus['text_username']."</b><input type=\"text\" name=\"username\" style=\"width: 200px\" maxlength=\"24\" /></td><td class=\"embedded\"><b>".$lang_mybonus['text_to_be_given']."</b><select name=\"bonusgift\" id=\"giftselect\" onchange=\"customgift();\"> <option value=\"25\"> 25</option><option value=\"50\"> 50</option><option value=\"100\"> 100</option> <option value=\"200\"> 200</option> <option value=\"300\"> 300</option> <option value=\"400\"> 400</option><option value=\"500\"> 500</option><option value=\"1000\" selected=\"selected\"> 1,000</option><option value=\"5000\"> 5,000</option><option value=\"10000\"> 10,000</option><option value=\"0\">".$lang_mybonus['text_custom']."</option></select><input type=\"text\" name=\"bonusgift\" id=\"giftcustom\" style='width: 80px' disabled=\"disabled\" />".$lang_mybonus['text_karma_points']."</td></tr><tr><td class=\"embedded\" colspan=\"2\"><b>".$lang_mybonus['text_message']."</b><input type=\"text\" name=\"message\" style=\"width: 400px\" maxlength=\"100\" /></td></tr></table>";
print("<td class=\"rowfollow\" align='left'><h1>".$bonusarray['name']."</h1>".$bonusarray['description']."<br /><br />".$lang_mybonus['text_enter_receiver_name']."<br />$otheroption</td><td class=\"rowfollow nowrap\" align='center'>".$lang_mybonus['text_min']."25<br />".$lang_mybonus['text_max']."10,000</td>");
}
elseif ($i==9){ //charity giving
$otheroption = "<table width=\"100%\"><tr><td class=\"embedded\">".$lang_mybonus['text_ratio_below']."<select name=\"ratiocharity\"> <option value=\"0.1\"> 0.1</option><option value=\"0.2\"> 0.2</option><option value=\"0.3\" selected=\"selected\"> 0.3</option> <option value=\"0.4\"> 0.4</option> <option value=\"0.5\"> 0.5</option> <option value=\"0.6\"> 0.6</option><option value=\"0.7\"> 0.7</option><option value=\"0.8\"> 0.8</option></select>".$lang_mybonus['text_and_downloaded_above']." 10 GB</td><td class=\"embedded\"><b>".$lang_mybonus['text_to_be_given']."</b><select name=\"bonuscharity\" id=\"charityselect\" > <option value=\"1000\"> 1,000</option><option value=\"2000\"> 2,000</option><option value=\"3000\" selected=\"selected\"> 3000</option> <option value=\"5000\"> 5,000</option> <option value=\"8000\"> 8,000</option> <option value=\"10000\"> 10,000</option><option value=\"20000\"> 20,000</option><option value=\"50000\"> 50,000</option></select>".$lang_mybonus['text_karma_points']."</td></tr></table>";
print("<td class=\"rowfollow\" align='left'><h1>".$bonusarray['name']."</h1>".$bonusarray['description']."<br /><br />".$lang_mybonus['text_select_receiver_ratio']."<br />$otheroption</td><td class=\"rowfollow nowrap\" align='center'>".$lang_mybonus['text_min']."1,000<br />".$lang_mybonus['text_max']."50,000</td>");
}
else{ //for VIP or Upload
print("<td class=\"rowfollow\" align='left'><h1>".$bonusarray['name']."</h1>".$bonusarray['description']."</td><td class=\"rowfollow\" align='center'>".number_format($bonusarray['points'])."</td>");
}
if($CURUSER['seedbonus'] >= $bonusarray['points'])
{
if ($i==7){
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['submit_karma_gift']."\" /></td>");
}
elseif ($i==8){
if ($enablenoad_advertisement == 'yes' && get_user_class() >= $noad_advertisement)
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['submit_class_above_no_ad']."\" disabled=\"disabled\" /></td>");
elseif (strtotime($CURUSER['noaduntil']) >= TIMENOW)
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['submit_already_disabled']."\" disabled=\"disabled\" /></td>");
elseif (get_user_class() < $bonusnoad_advertisement)
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".get_user_class_name($bonusnoad_advertisement,false,false,true).$lang_mybonus['text_plus_only']."\" disabled=\"disabled\" /></td>");
else
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['submit_exchange']."\" /></td>");
}
elseif ($i==9){
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['submit_charity_giving']."\" /></td>");
}
elseif($i==4)
{
if(get_user_class() < $buyinvite_class)
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".get_user_class_name($buyinvite_class,false,false,true).$lang_mybonus['text_plus_only']."\" disabled=\"disabled\" /></td>");
else
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['submit_exchange']."\" /></td>");
}
elseif ($i==6)
{
if (get_user_class() >= UC_VIP)
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['std_class_above_vip']."\" disabled=\"disabled\" /></td>");
else
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['submit_exchange']."\" /></td>");
}
elseif ($i==5)
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['submit_exchange']."\" /></td>");
else
{
if ($CURUSER['downloaded'] > 0){
if ($CURUSER['uploaded'] > $dlamountlimit_bonus * 1073741824)//Uploaded amount reach limit
$ratio = $CURUSER['uploaded']/$CURUSER['downloaded'];
else $ratio = 0;
}
else $ratio = $ratiolimit_bonus + 1; //Ratio always above limit
if ($ratiolimit_bonus > 0 && $ratio > $ratiolimit_bonus){
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['text_ratio_too_high']."\" disabled=\"disabled\" /></td>");
}
else print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['submit_exchange']."\" /></td>");
}
}
else
{
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['text_more_points_needed']."\" disabled=\"disabled\" /></td>");
}
print("</form>");
print("</tr>");
}
print("</table><br />");
?>
<table width="940" cellpadding="3">
<tr><td class="colhead" align="center"><font class="big"><?php echo $lang_mybonus['text_what_is_karma'] ?></font></td></tr>
<tr><td class="text" align="left">
<?php
print("<h1>".$lang_mybonus['text_get_by_seeding']."</h1>");
print("<ul>");
if ($perseeding_bonus > 0)
print("<li>".$perseeding_bonus.$lang_mybonus['text_point'].add_s($perseeding_bonus).$lang_mybonus['text_for_seeding_torrent'].$maxseeding_bonus.$lang_mybonus['text_torrent'].add_s($maxseeding_bonus).")</li>");
print("<li>".$lang_mybonus['text_bonus_formula_one'].$tzero_bonus.$lang_mybonus['text_bonus_formula_two'].$nzero_bonus.$lang_mybonus['text_bonus_formula_three'].$bzero_bonus.$lang_mybonus['text_bonus_formula_four'].$l_bonus.$lang_mybonus['text_bonus_formula_five']."</li>");
if ($donortimes_bonus)
print("<li>".$lang_mybonus['text_donors_always_get'].$donortimes_bonus.$lang_mybonus['text_times_of_bonus']."</li>");
print("</ul>");
$sqrtof2 = sqrt(2);
$logofpointone = log(0.1);
$valueone = $logofpointone / $tzero_bonus;
$pi = 3.141592653589793;
$valuetwo = $bzero_bonus * ( 2 / $pi);
$valuethree = $logofpointone / ($nzero_bonus - 1);
$timenow = strtotime(date("Y-m-d H:i:s"));
$sectoweek = 7*24*60*60;
$A = 0;
$count = 0;
$torrentres = sql_query("select torrents.id, torrents.added, torrents.size, torrents.seeders from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = $CURUSER[id] AND peers.seeder ='yes' GROUP BY torrents.id") or sqlerr(__FILE__, __LINE__);
while ($torrent = mysql_fetch_array($torrentres))
{
$weeks_alive = ($timenow - strtotime($torrent[added])) / $sectoweek;
$gb_size = $torrent[size] / 1073741824;
$temp = (1 - exp($valueone * $weeks_alive)) * $gb_size * (1 + $sqrtof2 * exp($valuethree * ($torrent[seeders] - 1)));
$A += $temp;
$count++;
}
if ($count > $maxseeding_bonus)
$count = $maxseeding_bonus;
$all_bonus = $valuetwo * atan($A / $l_bonus) + ($perseeding_bonus * $count);
$percent = $all_bonus * 100 / ($bzero_bonus + $perseeding_bonus * $maxseeding_bonus);
print("<div align=\"center\">".$lang_mybonus['text_you_are_currently_getting'].round($all_bonus,3).$lang_mybonus['text_point'].add_s($all_bonus).$lang_mybonus['text_per_hour']." (A = ".round($A,1).")</div><table align=\"center\" border=\"0\" width=\"400\"><tr><td class=\"loadbarbg\" style='border: none; padding: 0px;'>");
if ($percent <= 30) $loadpic = "loadbarred";
elseif ($percent <= 60) $loadpic = "loadbaryellow";
else $loadpic = "loadbargreen";
$width = $percent * 4;
print("<img class=\"".$loadpic."\" src=\"pic/trans.gif\" style=\"width: ".$width."px;\" alt=\"".$percent."%\" /></td></tr></table>");
print("<h1>".$lang_mybonus['text_other_things_get_bonus']."</h1>");
print("<ul>");
if ($uploadtorrent_bonus > 0)
print("<li>".$lang_mybonus['text_upload_torrent'].$uploadtorrent_bonus.$lang_mybonus['text_point'].add_s($uploadtorrent_bonus)."</li>");
if ($uploadsubtitle_bonus > 0)
print("<li>".$lang_mybonus['text_upload_subtitle'].$uploadsubtitle_bonus.$lang_mybonus['text_point'].add_s($uploadsubtitle_bonus)."</li>");
if ($starttopic_bonus > 0)
print("<li>".$lang_mybonus['text_start_topic'].$starttopic_bonus.$lang_mybonus['text_point'].add_s($starttopic_bonus)."</li>");
if ($makepost_bonus > 0)
print("<li>".$lang_mybonus['text_make_post'].$makepost_bonus.$lang_mybonus['text_point'].add_s($makepost_bonus)."</li>");
if ($addcomment_bonus > 0)
print("<li>".$lang_mybonus['text_add_comment'].$addcomment_bonus.$lang_mybonus['text_point'].add_s($addcomment_bonus)."</li>");
if ($pollvote_bonus > 0)
print("<li>".$lang_mybonus['text_poll_vote'].$pollvote_bonus.$lang_mybonus['text_point'].add_s($pollvote_bonus)."</li>");
if ($offervote_bonus > 0)
print("<li>".$lang_mybonus['text_offer_vote'].$offervote_bonus.$lang_mybonus['text_point'].add_s($offervote_bonus)."</li>");
if ($funboxvote_bonus > 0)
print("<li>".$lang_mybonus['text_funbox_vote'].$funboxvote_bonus.$lang_mybonus['text_point'].add_s($funboxvote_bonus)."</li>");
if ($ratetorrent_bonus > 0)
print("<li>".$lang_mybonus['text_rate_torrent'].$ratetorrent_bonus.$lang_mybonus['text_point'].add_s($ratetorrent_bonus)."</li>");
if ($saythanks_bonus > 0)
print("<li>".$lang_mybonus['text_say_thanks'].$saythanks_bonus.$lang_mybonus['text_point'].add_s($saythanks_bonus)."</li>");
if ($receivethanks_bonus > 0)
print("<li>".$lang_mybonus['text_receive_thanks'].$receivethanks_bonus.$lang_mybonus['text_point'].add_s($receivethanks_bonus)."</li>");
if ($adclickbonus_advertisement > 0)
print("<li>".$lang_mybonus['text_click_on_ad'].$adclickbonus_advertisement.$lang_mybonus['text_point'].add_s($adclickbonus_advertisement)."</li>");
if ($prolinkpoint_bonus > 0)
print("<li>".$lang_mybonus['text_promotion_link_clicked'].$prolinkpoint_bonus.$lang_mybonus['text_point'].add_s($prolinkpoint_bonus)."</li>");
if ($funboxreward_bonus > 0)
print("<li>".$lang_mybonus['text_funbox_reward']."</li>");
print($lang_mybonus['text_howto_get_karma_four']);
if ($ratiolimit_bonus > 0)
print("<li>".$lang_mybonus['text_user_with_ratio_above'].$ratiolimit_bonus.$lang_mybonus['text_and_uploaded_amount_above'].$dlamountlimit_bonus.$lang_mybonus['text_cannot_exchange_uploading']."</li>");
print($lang_mybonus['text_howto_get_karma_five'].$uploadtorrent_bonus.$lang_mybonus['text_point'].add_s($uploadtorrent_bonus).$lang_mybonus['text_howto_get_karma_six']);
?>
</td></tr></table>
<?php
}
// Bonus exchange
if ($action == "exchange") {
if ($_POST["userid"] || $_POST["points"] || $_POST["bonus"] || $_POST["art"]){
write_log("User " . $CURUSER["username"] . "," . $CURUSER["ip"] . " is trying to cheat at bonus system",'mod');
die($lang_mybonus['text_cheat_alert']);
}
$option = (int)$_POST["option"];
$bonusarray = bonusarray($option);
$points = $bonusarray['points'];
$userid = $CURUSER['id'];
$art = $bonusarray['art'];
$bonuscomment = $CURUSER['bonuscomment'];
$seedbonus=$CURUSER['seedbonus']-$points;
if($CURUSER['seedbonus'] >= $points) {
//=== trade for upload
if($art == "traffic") {
if ($CURUSER['uploaded'] > $dlamountlimit_bonus * 1073741824)//uploaded amount reach limit
$ratio = $CURUSER['uploaded']/$CURUSER['downloaded'];
else $ratio = 0;
if ($ratiolimit_bonus > 0 && $ratio > $ratiolimit_bonus)
die($lang_mybonus['text_cheat_alert']);
else {
$upload = $CURUSER['uploaded'];
$up = $upload + $bonusarray['menge'];
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for upload bonus.\n " .$bonuscomment;
sql_query("UPDATE users SET uploaded = ".sqlesc($up).", seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=upload");
}
}
//=== trade for one month VIP status ***note "SET class = '10'" change "10" to whatever your VIP class number is
elseif($art == "class") {
if (get_user_class() >= UC_VIP) {
stdmsg($lang_mybonus['std_no_permission'],$lang_mybonus['std_class_above_vip'], 0);
stdfoot();
die;
}
$vip_until = date("Y-m-d H:i:s",(strtotime(date("Y-m-d H:i:s")) + 28*86400));
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for 1 month VIP Status.\n " .htmlspecialchars($bonuscomment);
sql_query("UPDATE users SET class = '".UC_VIP."', vip_added = 'yes', vip_until = ".sqlesc($vip_until).", seedbonus = seedbonus - $points WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=vip");
}
//=== trade for invites
elseif($art == "invite") {
if(get_user_class() < $buyinvite_class)
die(get_user_class_name($buyinvite_class,false,false,true).$lang_mybonus['text_plus_only']);
$invites = $CURUSER['invites'];
$inv = $invites+$bonusarray['menge'];
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for invites.\n " .htmlspecialchars($bonuscomment);
sql_query("UPDATE users SET invites = ".sqlesc($inv).", seedbonus = seedbonus - $points WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=invite");
}
//=== trade for special title
/**** the $words array are words that you DO NOT want the user to have... use to filter "bad words" & user class...
the user class is just for show, but what the hell tongue.gif Add more or edit to your liking.
*note if they try to use a restricted word, they will recieve the special title "I just wasted my karma" *****/
elseif($art == "title") {
//===custom title
$title = $_POST["title"];
$title = sqlesc($title);
$words = array("fuck", "shit", "pussy", "cunt", "nigger", "Staff Leader","SysOp", "Administrator","Moderator","Uploader","Retiree","VIP","Nexus Master","Ultimate User","Extreme User","Veteran User","Insane User","Crazy User","Elite User","Power User","User","Peasant","Champion");
$title = str_replace($words, $lang_mybonus['text_wasted_karma'], $title);
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for custom title. Old title is ".htmlspecialchars(trim($CURUSER["title"]))." and new title is $title\n " .htmlspecialchars($bonuscomment);
sql_query("UPDATE users SET title = $title, seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=title");
}
elseif($art == "noad" && $enablead_advertisement == 'yes' && $enablebonusnoad_advertisement == 'yes') {
if (($enablenoad_advertisement == 'yes' && get_user_class() >= $noad_advertisement) || strtotime($CURUSER['noaduntil']) >= TIMENOW || get_user_class() < $bonusnoad_advertisement)
die($lang_mybonus['text_cheat_alert']);
else{
$noaduntil = date("Y-m-d H:i:s",(TIMENOW + $bonusarray['menge']));
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for ".$bonusnoadtime_advertisement." days without ads.\n " .htmlspecialchars($bonuscomment);
sql_query("UPDATE users SET noad='yes', noaduntil='".$noaduntil."', seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id=".sqlesc($userid));
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=noad");
}
}
elseif($art == 'gift_2') // charity giving
{
$points = intval($_POST["bonuscharity"] ?? 0);
if ($points < 1000 || $points > 50000){
stdmsg($lang_mybonus['text_error'], $lang_mybonus['bonus_amount_not_allowed_two'], 0);
stdfoot();
die();
}
$ratiocharity = $_POST["ratiocharity"];
if ($ratiocharity < 0.1 || $ratiocharity > 0.8){
stdmsg($lang_mybonus['text_error'], $lang_mybonus['bonus_ratio_not_allowed']);
stdfoot();
die();
}
if($CURUSER['seedbonus'] >= $points) {
$points2= number_format($points,1);
$bonuscomment = date("Y-m-d") . " - " .$points2. " Points as charity to users with ratio below ".htmlspecialchars(trim($ratiocharity)).".\n " .htmlspecialchars($bonuscomment);
$charityReceiverCount = get_row_count("users", "WHERE enabled='yes' AND 10737418240 < downloaded AND $ratiocharity > uploaded/downloaded");
if ($charityReceiverCount) {
sql_query("UPDATE users SET seedbonus = seedbonus - $points, charity = charity + $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
$charityPerUser = $points/$charityReceiverCount;
sql_query("UPDATE users SET seedbonus = seedbonus + $charityPerUser WHERE enabled='yes' AND 10737418240 < downloaded AND $ratiocharity > uploaded/downloaded") or sqlerr(__FILE__, __LINE__);
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=charity");
}
else
{
stdmsg($lang_mybonus['std_sorry'], $lang_mybonus['std_no_users_need_charity']);
stdfoot();
die;
}
}
}
elseif($art == "gift_1" && $bonusgift_bonus == 'yes') {
//=== trade for giving the gift of karma
$points = $_POST["bonusgift"];
$message = $_POST["message"];
//==gift for peeps with no more options
$usernamegift = sqlesc(trim($_POST["username"]));
$res = sql_query("SELECT id, bonuscomment FROM users WHERE username=" . $usernamegift);
$arr = mysql_fetch_assoc($res);
$useridgift = $arr['id'];
$userseedbonus = $arr['seedbonus'];
$receiverbonuscomment = $arr['bonuscomment'];
if ($points < 25 || $points > 10000) {
//write_log("User " . $CURUSER["username"] . "," . $CURUSER["ip"] . " is hacking bonus system",'mod');
stdmsg($lang_mybonus['text_error'], $lang_mybonus['bonus_amount_not_allowed']);
stdfoot();
die();
}
if($CURUSER['seedbonus'] >= $points) {
$points2= number_format($points,1);
$bonuscomment = date("Y-m-d") . " - " .$points2. " Points as gift to ".htmlspecialchars(trim($_POST["username"])).".\n " .htmlspecialchars($bonuscomment);
$aftertaxpoint = $points;
if ($taxpercentage_bonus)
$aftertaxpoint -= $aftertaxpoint * $taxpercentage_bonus * 0.01;
if ($basictax_bonus)
$aftertaxpoint -= $basictax_bonus;
$points2receiver = number_format($aftertaxpoint,1);
$newreceiverbonuscomment = date("Y-m-d") . " + " .$points2receiver. " Points (after tax) as a gift from ".($CURUSER["username"]).".\n " .htmlspecialchars($receiverbonuscomment);
if ($userid==$useridgift){
stdmsg($lang_mybonus['text_huh'], $lang_mybonus['text_karma_self_giving_warning'], 0);
stdfoot();
die;
}
if (!$useridgift){
stdmsg($lang_mybonus['text_error'], $lang_mybonus['text_receiver_not_exists'], 0);
stdfoot();
die;
}
sql_query("UPDATE users SET seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE users SET seedbonus = seedbonus + $aftertaxpoint, bonuscomment = ".sqlesc($newreceiverbonuscomment)." WHERE id = ".sqlesc($useridgift));
//===send message
$subject = sqlesc($lang_mybonus_target[get_user_lang($useridgift)]['msg_someone_loves_you']);
$added = sqlesc(date("Y-m-d H:i:s"));
$msg = $lang_mybonus_target[get_user_lang($useridgift)]['msg_you_have_been_given'].$points2.$lang_mybonus_target[get_user_lang($useridgift)]['msg_after_tax'].$points2receiver.$lang_mybonus_target[get_user_lang($useridgift)]['msg_karma_points_by'].$CURUSER['username'];
if ($message)
$msg .= "\n".$lang_mybonus_target[get_user_lang($useridgift)]['msg_personal_message_from'].$CURUSER['username'].$lang_mybonus_target[get_user_lang($useridgift)]['msg_colon'].$message;
$msg = sqlesc($msg);
sql_query("INSERT INTO messages (sender, subject, receiver, msg, added) VALUES(0, $subject, $useridgift, $msg, $added)") or sqlerr(__FILE__, __LINE__);
$usernamegift = unesc($_POST["username"]);
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=transfer");
}
else{
print("<table width=\"940\"><tr><td class=\"colhead\" align=\"left\" colspan=\"2\"><h1>".$lang_mybonus['text_oups']."</h1></td></tr>");
print("<tr><td align=\"left\"></td><td align=\"left\">".$lang_mybonus['text_not_enough_karma']."<br /><br /></td></tr></table>");
}
}
}
}
stdfoot();
?>
+370
View File
@@ -0,0 +1,370 @@
<?php
/* $Id: mysql_stats.php,v 1.0 2005/06/20 22:52:24 CoLdFuSiOn Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:
require "../include/bittorrent.php";
dbconn();
loggedinorreturn();
/**
* Checks if the user is allowed to do what he tries to...
*/
if (get_user_class() < UC_SYSOP)
stderr("Error", "Permission denied.");
$GLOBALS["byteUnits"] = array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
$day_of_week = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
$month = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
// See http://www.php.net/manual/en/function.strftime.php to define the
// variable below
$datefmt = '%B %d, %Y at %I:%M %p';
$timespanfmt = '%s days, %s hours, %s minutes and %s seconds';
////////////////// FUNCTION LIST /////////////////////////
/**
* Formats $value to byte view
*
* @param double the value to format
* @param integer the sensitiveness
* @param integer the number of decimals to retain
*
* @return array the formatted value and its unit
*
* @access public
*
* @author staybyte
* @version 1.0 - 20 July 2005
*/
function formatByteDown($value, $limes = 6, $comma = 0)
{
$dh = pow(10, $comma);
$li = pow(10, $limes);
$return_value = $value;
$unit = $GLOBALS['byteUnits'][0];
for ( $d = 6, $ex = 15; $d >= 1; $d--, $ex-=3 ) {
if (isset($GLOBALS['byteUnits'][$d]) && $value >= $li * pow(10, $ex)) {
$value = round($value / ( pow(1024, $d) / $dh) ) /$dh;
$unit = $GLOBALS['byteUnits'][$d];
break 1;
} // end if
} // end for
if ($unit != $GLOBALS['byteUnits'][0]) {
$return_value = number_format($value, $comma, '.', ',');
} else {
$return_value = number_format($value, 0, '.', ',');
}
return array($return_value, $unit);
} // end of the 'formatByteDown' function
/**
* Returns a given timespan value in a readable format.
*
* @param int the timespan
*
* @return string the formatted value
*/
function timespanFormat($seconds)
{
$return_string = '';
$days = floor($seconds / 86400);
if ($days > 0) {
$seconds -= $days * 86400;
}
$hours = floor($seconds / 3600);
if ($days > 0 || $hours > 0) {
$seconds -= $hours * 3600;
}
$minutes = floor($seconds / 60);
if ($days > 0 || $hours > 0 || $minutes > 0) {
$seconds -= $minutes * 60;
}
return (string)$days." Days ". (string)$hours." Hours ". (string)$minutes." Minutes ". (string)$seconds." Seconds ";
}
/**
* Writes localised date
*
* @param string the current timestamp
*
* @return string the formatted date
*
* @access public
*/
function localisedDate($timestamp = -1, $format = '')
{
global $datefmt, $month, $day_of_week;
if ($format == '') {
$format = $datefmt;
}
if ($timestamp == -1) {
$timestamp = time();
}
$date = preg_replace('@%[aA]@', $day_of_week[(int)strftime('%w', $timestamp)], $format);
$date = preg_replace('@%[bB]@', $month[(int)strftime('%m', $timestamp)-1], $date);
return strftime($date, $timestamp);
} // end of the 'localisedDate()' function
////////////////////// END FUNCTION LIST /////////////////////////////////////
stdhead("Stats");
/**
* Displays the sub-page heading
*/
echo '<h1 align=center>' . "\n"
. ' Mysql Server Status' . "\n"
. '</h1>' . "\n";
/**
* Sends the query and buffers the result
*/
$res = @sql_query('SHOW STATUS') or Die(mysql_error());
while ($row = mysql_fetch_row($res)) {
$serverStatus[$row[0]] = $row[1];
}
@mysql_free_result($res);
unset($res);
unset($row);
/**
* Displays the page
*/
//Uptime calculation
$res = @sql_query('SELECT UNIX_TIMESTAMP() - ' . $serverStatus['Uptime']);
$row = mysql_fetch_row($res);
//echo sprintf("Server Status Uptime", timespanFormat($serverStatus['Uptime']), localisedDate($row[0])) . "\n";
?>
<table id="torrenttable" border="1"><tr><td>
<?php
print("This MySQL server has been running for ". timespanFormat($serverStatus['Uptime']) .". It started up on ". localisedDate($row[0])) . "\n";
?>
</td></tr></table>
<?php
mysql_free_result($res);
unset($res);
unset($row);
//Get query statistics
$queryStats = array();
$tmp_array = $serverStatus;
foreach($tmp_array AS $name => $value) {
if (substr($name, 0, 4) == 'Com_') {
$queryStats[str_replace('_', ' ', substr($name, 4))] = $value;
unset($serverStatus[$name]);
}
}
unset($tmp_array);
?>
<ul>
<li>
<b>Server traffic:</b> These tables show the network traffic statistics of this MySQL server since its startup
<br />
<table border="0">
<tr>
<td valign="top">
<table id="torrenttable" border="0">
<tr>
<th colspan="2" bgcolor="lightgrey">&nbsp;Traffic&nbsp;</th>
<th bgcolor="lightgrey">&nbsp;&nbsp;Per Hour&nbsp;</th>
</tr>
<tr>
<td bgcolor="#EFF3FF">&nbsp;Received&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo join(' ', formatByteDown($serverStatus['Bytes_received'])); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo join(' ', formatByteDown($serverStatus['Bytes_received'] * 3600 / $serverStatus['Uptime'])); ?>&nbsp;</td>
</tr>
<tr>
<td bgcolor="#EFF3FF">&nbsp;Sent&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo join(' ', formatByteDown($serverStatus['Bytes_sent'])); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo join(' ', formatByteDown($serverStatus['Bytes_sent'] * 3600 / $serverStatus['Uptime'])); ?>&nbsp;</td>
</tr>
<tr>
<td bgcolor="lightgrey">&nbsp;Total&nbsp;</td>
<td bgcolor="lightgrey" align="right">&nbsp;<?php echo join(' ', formatByteDown($serverStatus['Bytes_received'] + $serverStatus['Bytes_sent'])); ?>&nbsp;</td>
<td bgcolor="lightgrey" align="right">&nbsp;<?php echo join(' ', formatByteDown(($serverStatus['Bytes_received'] + $serverStatus['Bytes_sent']) * 3600 / $serverStatus['Uptime'])); ?>&nbsp;</td>
</tr>
</table>
</td>
<td valign="top">
<table id="torrenttable" border="0">
<tr>
<th colspan="2" bgcolor="lightgrey">&nbsp;Connections&nbsp;</th>
<th bgcolor="lightgrey">&nbsp;&oslash;&nbsp;Per Hour&nbsp;</th>
<th bgcolor="lightgrey">&nbsp;%&nbsp;</th>
</tr>
<tr>
<td bgcolor="#EFF3FF">&nbsp;Failed Attempts&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo number_format($serverStatus['Aborted_connects'], 0, '.', ','); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo number_format(($serverStatus['Aborted_connects'] * 3600 / $serverStatus['Uptime']), 2, '.', ','); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo ($serverStatus['Connections'] > 0 ) ? number_format(($serverStatus['Aborted_connects'] * 100 / $serverStatus['Connections']), 2, '.', ',') . '&nbsp;%' : '---'; ?>&nbsp;</td>
</tr>
<tr>
<td bgcolor="#EFF3FF">&nbsp;Aborted Clients&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo number_format($serverStatus['Aborted_clients'], 0, '.', ','); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo number_format(($serverStatus['Aborted_clients'] * 3600 / $serverStatus['Uptime']), 2, '.', ','); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo ($serverStatus['Connections'] > 0 ) ? number_format(($serverStatus['Aborted_clients'] * 100 / $serverStatus['Connections']), 2 , '.', ',') . '&nbsp;%' : '---'; ?>&nbsp;</td>
</tr>
<tr>
<td bgcolor="lightgrey">&nbsp;Total&nbsp;</td>
<td bgcolor="lightgrey" align="right">&nbsp;<?php echo number_format($serverStatus['Connections'], 0, '.', ','); ?>&nbsp;</td>
<td bgcolor="lightgrey" align="right">&nbsp;<?php echo number_format(($serverStatus['Connections'] * 3600 / $serverStatus['Uptime']), 2, '.', ','); ?>&nbsp;</td>
<td bgcolor="lightgrey" align="right">&nbsp;<?php echo number_format(100, 2, '.', ','); ?>&nbsp;%&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</li>
<br />
<li>
<?php print("<b>Query Statistics:</b> Since it's start up, ". number_format($serverStatus['Questions'], 0, '.', ',')." queries have been sent to the server.\n"); ?>
<table border="0">
<tr>
<td colspan="2">
<br />
<table id="torrenttable" border="0" align="right">
<tr>
<th bgcolor="lightgrey">&nbsp;Total&nbsp;</th>
<th bgcolor="lightgrey">&nbsp;&oslash;&nbsp;Per&nbsp;Hour&nbsp;</th>
<th bgcolor="lightgrey">&nbsp;&oslash;&nbsp;Per&nbsp;Minute&nbsp;</th>
<th bgcolor="lightgrey">&nbsp;&oslash;&nbsp;Per&nbsp;Second&nbsp;</th>
</tr>
<tr>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo number_format($serverStatus['Questions'], 0, '.', ','); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo number_format(($serverStatus['Questions'] * 3600 / $serverStatus['Uptime']), 2, '.', ','); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo number_format(($serverStatus['Questions'] * 60 / $serverStatus['Uptime']), 2, '.', ','); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo number_format(($serverStatus['Questions'] / $serverStatus['Uptime']), 2, '.', ','); ?>&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table id="torrenttable" border="0">
<tr>
<th colspan="2" bgcolor="lightgrey">&nbsp;Query&nbsp;Type&nbsp;</th>
<th bgcolor="lightgrey">&nbsp;&oslash;&nbsp;Per&nbsp;Hour&nbsp;</th>
<th bgcolor="lightgrey">&nbsp;%&nbsp;</th>
</tr>
<?php
$useBgcolorOne = TRUE;
$countRows = 0;
foreach ($queryStats as $name => $value) {
// For the percentage column, use Questions - Connections, because
// the number of connections is not an item of the Query types
// but is included in Questions. Then the total of the percentages is 100.
?>
<tr>
<td bgcolor="#EFF3FF">&nbsp;<?php echo htmlspecialchars($name); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo number_format($value, 0, '.', ','); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo number_format(($value * 3600 / $serverStatus['Uptime']), 2, '.', ','); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo number_format(($value * 100 / ($serverStatus['Questions'] - $serverStatus['Connections'])), 2, '.', ','); ?>&nbsp;%&nbsp;</td>
</tr>
<?php
$useBgcolorOne = !$useBgcolorOne;
if (++$countRows == ceil(count($queryStats) / 2)) {
$useBgcolorOne = TRUE;
?>
</table>
</td>
<td valign="top">
<table id="torrenttable" border="0">
<tr>
<th colspan="2" bgcolor="lightgrey">&nbsp;Query&nbsp;Type&nbsp;</th>
<th bgcolor="lightgrey">&nbsp;&oslash;&nbsp;Per&nbsp;Hour&nbsp;</th>
<th bgcolor="lightgrey">&nbsp;%&nbsp;</th>
</tr>
<?php
}
}
unset($countRows);
unset($useBgcolorOne);
?>
</table>
</td>
</tr>
</table>
</li>
<?php
//Unset used variables
unset($serverStatus['Aborted_clients']);
unset($serverStatus['Aborted_connects']);
unset($serverStatus['Bytes_received']);
unset($serverStatus['Bytes_sent']);
unset($serverStatus['Connections']);
unset($serverStatus['Questions']);
unset($serverStatus['Uptime']);
if (!empty($serverStatus)) {
?>
<br />
<li>
<b>More status variables</b><br />
<table border="0">
<tr>
<td valign="top">
<table id="torrenttable" border="0">
<tr>
<th bgcolor="lightgrey">&nbsp;Variable&nbsp;</th>
<th bgcolor="lightgrey">&nbsp;Value&nbsp;</th>
</tr>
<?php
$useBgcolorOne = TRUE;
$countRows = 0;
foreach($serverStatus AS $name => $value) {
?>
<tr>
<td bgcolor="#EFF3FF">&nbsp;<?php echo htmlspecialchars(str_replace('_', ' ', $name)); ?>&nbsp;</td>
<td bgcolor="#EFF3FF" align="right">&nbsp;<?php echo htmlspecialchars($value); ?>&nbsp;</td>
</tr>
<?php
$useBgcolorOne = !$useBgcolorOne;
if (++$countRows == ceil(count($serverStatus) / 3) || $countRows == ceil(count($serverStatus) * 2 / 3)) {
$useBgcolorOne = TRUE;
?>
</table>
</td>
<td valign="top">
<table id="torrenttable" border="0">
<tr>
<th bgcolor="lightgrey">&nbsp;Variable&nbsp;</th>
<th bgcolor="lightgrey">&nbsp;Value&nbsp;</th>
</tr>
<?php
}
}
unset($useBgcolorOne);
?>
</table>
</td>
</tr>
</table>
</li>
<?php
}
?>
</ul>
<?php
stdfoot();
+129
View File
@@ -0,0 +1,129 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
if (get_user_class() < $newsmanage_class)
permissiondenied();
$action = htmlspecialchars($_GET["action"] ?? '');
// Delete News Item //////////////////////////////////////////////////////
if ($action == 'delete')
{
$newsid = intval($_GET["newsid"] ?? 0);
int_check($newsid,true);
$returnto = !empty($_GET["returnto"]) ? htmlspecialchars($_GET["returnto"]) : htmlspecialchars($_SERVER["HTTP_REFERER"]);
$sure = intval($_GET["sure"] ?? 0);
if (!$sure)
stderr($lang_news['std_delete_news_item'], $lang_news['std_are_you_sure'] . "<a class=altlink href=?action=delete&newsid=$newsid&returnto=$returnto&sure=1>".$lang_news['std_here']."</a>".$lang_news['std_if_sure'],false);
sql_query("DELETE FROM news WHERE id=".sqlesc($newsid)) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('recent_news','true');
if ($returnto != "")
header("Location: $returnto");
else
header("Location: " . get_protocol_prefix() . "$BASEURL/index.php");
}
// Add News Item /////////////////////////////////////////////////////////
if ($action == 'add')
{
$body = htmlspecialchars($_POST['body'],ENT_QUOTES);
if (!$body)
stderr($lang_news['std_error'], $lang_news['std_news_body_empty']);
$title = htmlspecialchars($_POST['subject']);
if (!$title)
stderr($lang_news['std_error'], $lang_news['std_news_title_empty']);
$added = intval($_POST["added"] ?? 0);
if (!$added)
$added = sqlesc(date("Y-m-d H:i:s"));
$notify = $_POST['notify'] ?? '';
if ($notify != 'yes')
$notify = 'no';
sql_query("INSERT INTO news (userid, added, body, title, notify) VALUES (".sqlesc($CURUSER['id']) . ", $added, " . sqlesc($body) . ", " . sqlesc($title) . ", " . sqlesc($notify).")") or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('recent_news',true);
if (mysql_affected_rows() != 1)
stderr($lang_news['std_error'], $lang_news['std_something_weird_happened']);
header("Location: " . get_protocol_prefix() . "$BASEURL/index.php");
}
// Edit News Item ////////////////////////////////////////////////////////
if ($action == 'edit')
{
$newsid = intval($_GET["newsid"] ?? 0);
int_check($newsid,true);
$res = sql_query("SELECT * FROM news WHERE id=".sqlesc($newsid)) or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) != 1)
stderr($lang_news['std_error'], $lang_news['std_invalid_news_id'].$newsid);
$arr = mysql_fetch_array($res);
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$body = htmlspecialchars($_POST['body'],ENT_QUOTES);
if ($body == "")
stderr($lang_news['std_error'], $lang_news['std_news_body_empty']);
$title = htmlspecialchars($_POST['subject']);
if ($title == "")
stderr($lang_news['std_error'], $lang_news['std_news_title_empty']);
$body = sqlesc($body);
$editdate = sqlesc(date("Y-m-d H:i:s"));
$notify = $_POST['notify'] ?? '';
if ($notify != 'yes')
$notify = 'no';
$notify = sqlesc($notify);
$title = sqlesc($title);
sql_query("UPDATE news SET body=$body, title=$title, notify=$notify WHERE id=".sqlesc($newsid)) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('recent_news',true);
header("Location: " . get_protocol_prefix() . "$BASEURL/index.php");
}
else
{
stdhead($lang_news['head_edit_site_news']);
begin_main_frame();
$body = $arr["body"];
$subject = htmlspecialchars($arr['title']);
$title = $lang_news['text_edit_site_news'];
print("<form id=\"compose\" name=\"compose\" method=\"post\" action=\"".htmlspecialchars("?action=edit&newsid=".$newsid)."\">");
print("<input type=\"hidden\" name=\"returnto\" value=\"".($returnto ?? '')."\" />");
begin_compose($title, "edit", $body, true, $subject);
print("<tr><td class=\"toolbox\" align=\"center\" colspan=\"2\"><input type=\"checkbox\" name=\"notify\" value=\"yes\" ".($arr['notify'] == 'yes' ? " checked=\"checked\"" : "")." />".$lang_news['text_notify_users_of_this']."</td></tr>\n");
end_compose();
end_main_frame();
stdfoot();
die;
}
}
// Other Actions and followup ////////////////////////////////////////////
stdhead($lang_news['head_site_news']);
begin_main_frame();
$title = $lang_news['text_submit_news_item'];
print("<form id=\"compose\" method=\"post\" name=\"compose\" action=\"?action=add\">\n");
begin_compose($title, 'new');
print("<tr><td class=\"toolbox\" align=\"center\" colspan=\"2\"><input type=\"checkbox\" name=\"notify\" value=\"yes\" />".$lang_news['text_notify_users_of_this']."</td></tr>\n");
end_compose();
print("</form>");
end_main_frame();
stdfoot();
die;
?>
+42
View File
@@ -0,0 +1,42 @@
<?php
require_once("../include/bittorrent.php");
function bark($msg) {
stdhead();
stdmsg("Update Has Failed !", $msg);
stdfoot();
exit;
}
dbconn();
loggedinorreturn();
if(isset($_POST["nowarned"])&&($_POST["nowarned"]=="nowarned")){
//if (get_user_class() >= UC_SYSOP) {
if (get_user_class() < UC_MODERATOR)
stderr("Sorry", "Access denied.");
{
if (empty($_POST["usernw"]) && empty($_POST["desact"]) && empty($_POST["delete"]))
bark("You Must Select A User To Edit.");
if (!empty($_POST["usernw"]))
{
$msg = sqlesc("Your Warning Has Been Removed By: " . $CURUSER['username'] . ".");
$added = sqlesc(date("Y-m-d H:i:s"));
$userid = implode(", ", $_POST[usernw]);
//sql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
$r = sql_query("SELECT modcomment FROM users WHERE id IN (" . implode(", ", $_POST[usernw]) . ")")or sqlerr(__FILE__, __LINE__);
$user = mysql_fetch_array($r);
$exmodcomment = $user["modcomment"];
$modcomment = date("Y-m-d") . " - Warning Removed By " . $CURUSER['username'] . ".\n". $modcomment . $exmodcomment;
sql_query("UPDATE users SET modcomment=" . sqlesc($modcomment) . " WHERE id IN (" . implode(", ", $_POST[usernw]) . ")") or sqlerr(__FILE__, __LINE__);
$do="UPDATE users SET warned='no', warneduntil='0000-00-00 00:00:00' WHERE id IN (" . implode(", ", $_POST[usernw]) . ")";
$res=sql_query($do);}
if (!empty($_POST["desact"])){
$do="UPDATE users SET enabled='no' WHERE id IN (" . implode(", ", $_POST['desact']) . ")";
$res=sql_query($do);}
}
}
header("Refresh: 0; url=warned.php");
?>
+841
View File
@@ -0,0 +1,841 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
require_once(get_langfile_path("",true));
loggedinorreturn();
parked();
if ($enableoffer == 'no')
permissiondenied();
function bark($msg) {
global $lang_offers;
stdhead($lang_offers['head_offer_error']);
stdmsg($lang_offers['std_error'], $msg);
stdfoot();
exit;
}
if (isset($_GET['category']) && $_GET["category"]){
$categ = isset($_GET['category']) ? (int)$_GET['category'] : 0;
if(!is_valid_id($categ))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
if (isset($_GET['id']) && $_GET["id"]){
$id = htmlspecialchars(intval($_GET["id"] ?? 0));
if (preg_match('/^[0-9]+$/', !$id))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
//==== add offer
if (isset($_GET['add_offer']) && $_GET["add_offer"]){
if (get_user_class() < $addoffer_class)
permissiondenied();
$add_offer = intval($_GET["add_offer"] ?? 0);
if($add_offer != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
stdhead($lang_offers['head_offer']);
print("<p>".$lang_offers['text_red_star_required']."</p>");
print("<div align=\"center\"><form id=\"compose\" action=\"?new_offer=1\" name=\"compose\" method=\"post\">".
"<table width=940 border=0 cellspacing=0 cellpadding=5><tr><td class=colhead align=center colspan=2>".$lang_offers['text_offers_open_to_all']."</td></tr>\n");
$s = "<select name=type>\n<option value=0>".$lang_offers['select_type_select']."</option>\n";
$cats = genrelist($browsecatmode);
foreach ($cats as $row)
$s .= "<option value=".$row["id"].">" . htmlspecialchars($row["name"]) . "</option>\n";
$s .= "</select>\n";
print("<tr><td class=rowhead align=right><b>".$lang_offers['row_type']."<font color=red>*</font></b></td><td class=rowfollow align=left> $s</td></tr>".
"<tr><td class=rowhead align=right><b>".$lang_offers['row_title']."<font color=red>*</font></b></td><td class=rowfollow align=left><input type=text name=name style=\"width: 650px;\" />".
"</td></tr><tr><td class=rowhead align=right><b>".$lang_offers['row_post_or_photo']."</b></td><td class=rowfollow align=left>".
"<input type=text name=picture style=\"width: 650px;\"><br />".$lang_offers['text_link_to_picture']."</td></tr>".
"<tr><td class=rowhead align=right valign=top><b>".$lang_offers['row_description']."<b><font color=red>*</font></td><td class=rowfollow align=left>\n");
textbbcode("compose","body",$body,false);
print("</td></tr><tr><td class=toolbox align=center colspan=2><input id=qr type=submit class=btn value=".$lang_offers['submit_add_offer']." ></td></tr></table></form><br />\n");
stdfoot();
die;
}
//=== end add offer
//=== take new offer
if (isset($_GET['new_offer']) && $_GET["new_offer"]){
if (get_user_class() < $addoffer_class)
permissiondenied();
$new_offer = intval($_GET["new_offer"] ?? 0);
if($new_offer != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$userid = intval($CURUSER["id"] ?? 0);
if (preg_match("/^[0-9]+$/", !$userid))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$name = $_POST["name"];
if ($name == "")
bark($lang_offers['std_must_enter_name']);
$cat = intval($_POST["type"] ?? 0);
if (!is_valid_id($cat))
bark($lang_offers['std_must_select_category']);
$descrmain = unesc($_POST["body"]);
if (!$descrmain)
bark($lang_offers['std_must_enter_description']);
if (!empty($_POST['picture'])){
$picture = unesc($_POST["picture"]);
if(!preg_match("/^http:\/\/[^\s'\"<>]+\.(jpg|gif|png)$/i", $picture))
stderr($lang_offers['std_error'], $lang_offers['std_wrong_image_format']);
$pic = "[img]".$picture."[/img]\n";
}
$descr = $pic;
$descr .= $descrmain;
$res = sql_query("SELECT name FROM offers WHERE name =".sqlesc($_POST[name])) or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
if (!$arr['name']){
//===add karma //=== uncomment if you use the mod
//sql_query("UPDATE users SET seedbonus = seedbonus+10.0 WHERE id = $CURUSER[id]") or sqlerr(__FILE__, __LINE__);
//===end
$ret = sql_query("INSERT INTO offers (userid, name, descr, category, added) VALUES (" .
implode(",", array_map("sqlesc", array($CURUSER["id"], $name, $descr, intval($_POST["type"] ?? 0)))) .
", '" . date("Y-m-d H:i:s") . "')");
if (!$ret) {
if (mysql_errno() == 1062)
bark("!!!");
bark("mysql puked: ".mysql_error());
}
$id = mysql_insert_id();
write_log("offer $name was added by ".$CURUSER[username],'normal');
header("Refresh: 0; url=offers.php?id=$id&off_details=1");
stdhead($lang_offers['head_success']);
}
else{
stderr ($lang_offers['std_error'], $lang_offers['std_offer_exists']."<a class=altlink href=offers.php>".$lang_offers['text_view_all_offers']."</a>",false);
}
stdfoot();
die;
}
//==end take new offer
//=== offer details
if (isset($_GET['off_details']) && $_GET["off_details"]){
$off_details = intval($_GET["off_details"] ?? 0);
if($off_details != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$id = intval($_GET["id"] ?? 0);
if(!$id)
die();
//stderr("Error", "I smell a rat!");
$res = sql_query("SELECT * FROM offers WHERE id = $id") or sqlerr(__FILE__,__LINE__);
$num = mysql_fetch_array($res);
$s = $num["name"];
stdhead($lang_offers['head_offer_detail_for']." \"".$s."\"");
print("<h1 align=\"center\" id=\"top\">".htmlspecialchars($s)."</h1>");
print("<table width=\"940\" cellspacing=\"0\" cellpadding=\"5\">");
$offertime = gettime($num['added'],true,false);
if ($CURUSER['timetype'] != 'timealive')
$offertime = $lang_offers['text_at'].$offertime;
else $offertime = $lang_offers['text_blank'].$offertime;
tr($lang_offers['row_info'], $lang_offers['text_offered_by'].get_username($num['userid']).$offertime, 1);
if ($num["allowed"] == "pending")
$status="<font color=\"red\">".$lang_offers['text_pending']."</font>";
elseif ($num["allowed"] == "allowed")
$status="<font color=\"green\">".$lang_offers['text_allowed']."</font>";
else
$status="<font color=\"red\">".$lang_offers['text_denied']."</font>";
tr($lang_offers['row_status'], $status, 1);
//=== if you want to have a pending thing for uploaders use this next bit
if (get_user_class() >= $offermanage_class && $num["allowed"] == "pending")
tr($lang_offers['row_allow'], "<table><tr><td class=\"embedded\"><form method=\"post\" action=\"?allow_offer=1\"><input type=\"hidden\" value=\"".$id."\" name=\"offerid\" />".
"<input class=\"btn\" type=\"submit\" value=\"".$lang_offers['submit_allow']."\" />&nbsp;&nbsp;</form></td><td class=\"embedded\"><form method=\"post\" action=\"?id=".$id."&amp;finish_offer=1\">".
"<input type=\"hidden\" value=\"".$id."\" name=\"finish\" /><input class=\"btn\" type=\"submit\" value=\"".$lang_offers['submit_let_votes_decide']."\" /></form></td></tr></table>", 1);
$zres = sql_query("SELECT COUNT(*) from offervotes where vote='yeah' and offerid=$id");
$arr = mysql_fetch_row($zres);
$za = $arr[0];
$pres = sql_query("SELECT COUNT(*) from offervotes where vote='against' and offerid=$id");
$arr2 = mysql_fetch_row($pres);
$protiv = $arr2[0];
//=== in the following section, there is a line to report comment... either remove the link or change it to work with your report script :)
//if pending
if ($num["allowed"] == "pending"){
tr($lang_offers['row_vote'], "<b>".
"<a href=\"?id=".$id."&amp;vote=yeah\"><font color=\"green\">".$lang_offers['text_for']."</font></a></b>".(get_user_class() >= $againstoffer_class ? " - <b><a href=\"?id=".$id."&amp;vote=against\">".
"<font color=\"red\">".$lang_offers['text_against']."</font></a></b>" : ""), 1);
tr($lang_offers['row_vote_results'],
"<b>".$lang_offers['text_for'].":</b> $za <b>".$lang_offers['text_against']."</b> $protiv &nbsp; &nbsp; <a href=\"?id=".$id."&amp;offer_vote=1\"><i>".$lang_offers['text_see_vote_detail']."</i></a>", 1);
}
//===upload torrent message
if ($num["allowed"] == "allowed" && $CURUSER["id"] != $num["userid"])
tr($lang_offers['row_offer_allowed'], $lang_offers['text_voter_receives_pm_note'], 1);
if ($num["allowed"] == "allowed" && $CURUSER["id"] == $num["userid"]){
tr($lang_offers['row_offer_allowed'],
$lang_offers['text_urge_upload_offer_note'], 1);
}
if ($CURUSER[id] == $num[userid] || get_user_class() >= $offermanage_class){
$edit = "<a href=\"?id=".$id."&amp;edit_offer=1\"><img class=\"dt_edit\" src=\"pic/trans.gif\" alt=\"edit\" />&nbsp;<b><font class=\"small\">".$lang_offers['text_edit_offer'] . "</font></b></a>&nbsp;|&nbsp;";
$delete = "<a href=\"?id=".$id."&amp;del_offer=1&amp;sure=0\"><img class=\"dt_delete\" src=\"pic/trans.gif\" alt=\"delete\" />&nbsp;<b><font class=\"small\">".$lang_offers['text_delete_offer']."</font></b></a>&nbsp;|&nbsp;";
}
$report = "<a href=\"report.php?reportofferid=".$id."\"><img class=\"dt_report\" src=\"pic/trans.gif\" alt=\"report\" />&nbsp;<b><font class=\"small\">".$lang_offers['report_offer']."</font></b></a>";
tr($lang_offers['row_action'], $edit . $delete .$report, 1);
if ($num["descr"]){
$off_bb = format_comment($num["descr"]);
tr($lang_offers['row_description'], $off_bb, 1);
}
print("</table>");
// -----------------COMMENT SECTION ---------------------//
$commentbar = "<p align=\"center\"><a class=\"index\" href=\"comment.php?action=add&amp;pid=".$id."&amp;type=offer\">".$lang_offers['text_add_comment']."</a></p>\n";
$subres = sql_query("SELECT COUNT(*) FROM comments WHERE offer = $id");
$subrow = mysql_fetch_array($subres);
$count = $subrow[0];
if (!$count) {
print("<h1 id=\"startcomments\" align=\"center\">".$lang_offers['text_no_comments']."</h1>\n");
}
else {
list($pagertop, $pagerbottom, $limit) = pager(10, $count, "offers.php?id=$id&off_details=1&", array(lastpagedefault => 1));
$subres = sql_query("SELECT id, text, user, added, editedby, editdate FROM comments WHERE offer = " . sqlesc($id) . " ORDER BY id $limit") or sqlerr(__FILE__, __LINE__);
$allrows = array();
while ($subrow = mysql_fetch_array($subres))
$allrows[] = $subrow;
//end_frame();
//print($commentbar);
print($pagertop);
commenttable($allrows,"offer",$id);
print($pagerbottom);
}
print("<table style='border:1px solid #000000;'><tr>".
"<td class=\"text\" align=\"center\"><b>".$lang_offers['text_quick_comment']."</b><br /><br />".
"<form id=\"compose\" name=\"comment\" method=\"post\" action=\"comment.php?action=add&amp;type=offer\" onsubmit=\"return postvalid(this);\">".
"<input type=\"hidden\" name=\"pid\" value=\"".$id."\" /><br />");
quickreply('comment', 'body',$lang_offers['submit_add_comment']);
print("</form></td></tr></table>");
print($commentbar);
stdfoot();
die;
}
//=== end offer details
//=== allow offer by staff
if (isset($_GET["allow_offer"]) && $_GET["allow_offer"]) {
if (get_user_class() < $offermanage_class)
stderr($lang_offers['std_access_denied'], $lang_offers['std_mans_job']);
$allow_offer = intval($_GET["allow_offer"] ?? 0);
if($allow_offer != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
//=== to allow the offer credit to S4NE for this next bit :)
//if ($_POST["offerid"]){
$offid = intval($_POST["offerid"] ?? 0);
if(!is_valid_id($offid))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$res = sql_query("SELECT users.username, offers.userid, offers.name FROM offers inner join users on offers.userid = users.id where offers.id = $offid") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
if ($offeruptimeout_main){
$timeouthour = floor($offeruptimeout_main/3600);
$timeoutnote = $lang_offers_target[get_user_lang($arr["userid"])]['msg_you_must_upload_in'].$timeouthour.$lang_offers_target[get_user_lang($arr["userid"])]['msg_hours_otherwise'];
}
else $timeoutnote = "";
$msg = "$CURUSER[username]".$lang_offers_target[get_user_lang($arr["userid"])]['msg_has_allowed']."[b][url=". get_protocol_prefix() . $BASEURL ."/offers.php?id=$offid&off_details=1]" . $arr[name] . "[/url][/b]. ".$lang_offers_target[get_user_lang($arr["userid"])]['msg_find_offer_option'].$timeoutnote;
$subject = $lang_offers_target[get_user_lang($arr["userid"])]['msg_your_offer_allowed'];
$allowedtime = date("Y-m-d H:i:s");
sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[userid], '" . $allowedtime . "', " . sqlesc($msg) . ", ".sqlesc($subject).")") or sqlerr(__FILE__, __LINE__);
sql_query ("UPDATE offers SET allowed = 'allowed', allowedtime = '".$allowedtime."' WHERE id = $offid") or sqlerr(__FILE__,__LINE__);
write_log("$CURUSER[username] allowed offer $arr[name]",'normal');
header("Refresh: 0; url=" . get_protocol_prefix() . "$BASEURL/offers.php?id=$offid&off_details=1");
}
//=== end allow the offer
//=== allow offer by vote
if (isset($_GET["finish_offer"]) && $_GET["finish_offer"]) {
if (get_user_class() < $offermanage_class)
stderr($lang_offers['std_access_denied'], $lang_offers['std_have_no_permission']);
$finish_offer = intval($_GET["finish_offer"] ?? 0);
if($finish_offer != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$offid = intval($_POST["finish"] ?? 0);
if(!is_valid_id($offid))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$res = sql_query("SELECT users.username, offers.userid, offers.name FROM offers inner join users on offers.userid = users.id where offers.id = $offid") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
$voteresyes = sql_query("SELECT COUNT(*) from offervotes where vote='yeah' and offerid=$offid");
$arryes = mysql_fetch_row($voteresyes);
$yes = $arryes[0];
$voteresno = sql_query("SELECT COUNT(*) from offervotes where vote='against' and offerid=$offid");
$arrno = mysql_fetch_row($voteresno);
$no = $arrno[0];
if($yes == '0' && $no == '0')
stderr($lang_offers['std_sorry'], $lang_offers['std_no_votes_yet']."<a href=offers.php?id=$offid&off_details=1>".$lang_offers['std_back_to_offer_detail']."</a>",false);
$finishvotetime = date("Y-m-d H:i:s");
if (($yes - $no)>=$minoffervotes){
if ($offeruptimeout_main){
$timeouthour = floor($offeruptimeout_main/3600);
$timeoutnote = $lang_offers_target[get_user_lang($arr["userid"])]['msg_you_must_upload_in'].$timeouthour.$lang_offers_target[get_user_lang($arr["userid"])]['msg_hours_otherwise'];
}
else $timeoutnote = "";
$msg = $lang_offers_target[get_user_lang($arr["userid"])]['msg_offer_voted_on']."[b][url=" . get_protocol_prefix() . $BASEURL."/offers.php?id=$offid&off_details=1]" . $arr[name] . "[/url][/b].". $lang_offers_target[get_user_lang($arr["userid"])]['msg_find_offer_option'].$timeoutnote;
sql_query ("UPDATE offers SET allowed = 'allowed',allowedtime ='".$finishvotetime."' WHERE id = $offid") or sqlerr(__FILE__,__LINE__);
}
else if(($no - $yes)>=$minoffervotes){
$msg = $lang_offers_target[get_user_lang($arr["userid"])]['msg_offer_voted_off']."[b][url=". get_protocol_prefix() . $BASEURL."/offers.php?id=$offid&off_details=1]" . $arr[name] . "[/url][/b].".$lang_offers_target[get_user_lang($arr["userid"])]['msg_offer_deleted'] ;
sql_query ("UPDATE offers SET allowed = 'denied' WHERE id = $offid") or sqlerr(__FILE__,__LINE__);
}
//===use this line if you DO HAVE subject in your PM system
$subject = $lang_offers_target[get_user_lang($arr[userid])]['msg_your_offer'].$arr[name].$lang_offers_target[get_user_lang($arr[userid])]['msg_voted_on'];
sql_query("INSERT INTO messages (sender, subject, receiver, added, msg) VALUES(0, ".sqlesc($subject).", $arr[userid], '" . $finishvotetime . "', " . sqlesc($msg) . ")") or sqlerr(__FILE__, __LINE__);
//===use this line if you DO NOT subject in your PM system
//sql_query("INSERT INTO messages (sender, receiver, added, msg) VALUES(0, $arr[userid], '" . date("Y-m-d H:i:s") . "', " . sqlesc($msg) . ")") or sqlerr(__FILE__, __LINE__);
write_log("$CURUSER[username] closed poll $arr[name]",'normal');
header("Refresh: 0; url=" . get_protocol_prefix() . "$BASEURL/offers.php?id=$offid&off_details=1");
die;
}
//===end allow offer by vote
//=== edit offer
if (isset($_GET["edit_offer"]) && $_GET["edit_offer"]) {
$edit_offer = intval($_GET["edit_offer"] ?? 0);
if($edit_offer != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$id = intval($_GET["id"] ?? 0);
$res = sql_query("SELECT * FROM offers WHERE id = $id") or sqlerr(__FILE__, __LINE__);
$num = mysql_fetch_array($res);
$timezone = $num["added"];
$s = $num["name"];
$id2 = $num["category"];
if ($CURUSER["id"] != $num["userid"] && get_user_class() < $offermanage_class)
stderr($lang_offers['std_error'], $lang_offers['std_cannot_edit_others_offer']);
$body = htmlspecialchars(unesc($num["descr"]));
$s2 = "<select name=\"category\">\n";
$cats = genrelist($browsecatmode);
foreach ($cats as $row)
$s2 .= "<option value=\"" . $row["id"] . "\" ".($row['id'] == $id2 ? " selected=\"selected\"" : "").">" . htmlspecialchars($row["name"]) . "</option>\n";
$s2 .= "</select>\n";
stdhead($lang_offers['head_edit_offer'].": $s");
$title = htmlspecialchars(trim($s));
print("<form id=\"compose\" method=\"post\" name=\"compose\" action=\"?id=".$id."&amp;take_off_edit=1\">".
"<table width=\"940\" cellspacing=\"0\" cellpadding=\"3\"><tr><td class=\"colhead\" align=\"center\" colspan=\"2\">".$lang_offers['text_edit_offer']."</td></tr>");
tr($lang_offers['row_type']."<font color=\"red\">*</font>", $s2, 1);
tr($lang_offers['row_title']."<font color=\"red\">*</font>", "<input type=\"text\" style=\"width: 650px\" name=\"name\" value=\"".$title."\" />", 1);
tr($lang_offers['row_post_or_photo'], "<input type=\"text\" name=\"picture\" style=\"width: 650px\" value='' /><br />".$lang_offers['text_link_to_picture'], 1);
print("<tr><td class=\"rowhead\" align=\"right\" valign=\"top\"><b>".$lang_offers['row_description']."<font color=\"red\">*</font></b></td><td class=\"rowfollow\" align=\"left\">");
textbbcode("compose","body",$body,false);
print("</td></tr>");
print("<tr><td class=\"toolbox\" style=\"vertical-align: middle; padding-top: 10px; padding-bottom: 10px;\" align=\"center\" colspan=\"2\"><input id=\"qr\" type=\"submit\" value=\"".$lang_offers['submit_edit_offer']."\" class=\"btn\" /></td></tr></table></form><br />\n");
stdfoot();
die;
}
//=== end edit offer
//==== take offer edit
if (isset($_GET["take_off_edit"]) && $_GET["take_off_edit"]){
$take_off_edit = intval($_GET["take_off_edit"] ?? 0);
if($take_off_edit != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$id = intval($_GET["id"] ?? 0);
$res = sql_query("SELECT userid FROM offers WHERE id = $id") or sqlerr(__FILE__, __LINE__);
$num = mysql_fetch_array($res);
if ($CURUSER[id] != $num[userid] && get_user_class() < $offermanage_class)
stderr($lang_offers['std_error'], $lang_offers['std_access_denied']);
$name = $_POST["name"];
if (!empty($_POST['picture'])){
$picture = unesc($_POST["picture"]);
if(!preg_match("/^http:\/\/[^\s'\"<>]+\.(jpg|gif|png)$/i", $picture))
stderr($lang_offers['std_error'], $lang_offers['std_wrong_image_format']);
$pic = "[img]".$picture."[/img]\n";
}
$descr = "$pic";
$descr .= unesc($_POST["body"]);
if (!$name)
bark($lang_offers['std_must_enter_name']);
if (!$descr)
bark($lang_offers['std_must_enter_description']);
$cat = intval($_POST["category"] ?? 0);
if (!is_valid_id($cat))
bark($lang_offers['std_must_select_category']);
$name = sqlesc($name);
$descr = sqlesc($descr);
$cat = sqlesc($cat);
sql_query("UPDATE offers SET category=$cat, name=$name, descr=$descr where id=".sqlesc($id));
//header("Refresh: 0; url=offers.php?id=$id&off_details=1");
}
//======end take offer edit
//=== offer votes list
if (isset($_GET["offer_vote"]) && $_GET["offer_vote"]){
$offer_vote = intval($_GET["offer_vote"] ?? 0);
if($offer_vote != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$offerid = htmlspecialchars(intval($_GET['id'] ?? 0));
$res2 = sql_query("SELECT COUNT(*) FROM offervotes WHERE offerid = ".sqlesc($offerid)) or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_array($res2);
$count = $row[0];
$offername = get_single_value("offers","name","WHERE id=".sqlesc($offerid));
stdhead($lang_offers['head_offer_voters']." - \"".$offername."\"");
print("<h1 align=center>".$lang_offers['text_vote_results_for']." <a href=offers.php?id=$offerid&off_details=1><b>".htmlspecialchars($offername)."</b></a></h1>");
$perpage = 25;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] ."?id=".$offerid."&offer_vote=1&");
$res = sql_query("SELECT * FROM offervotes WHERE offerid=".sqlesc($offerid)." ".$limit) or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print("<p align=center><b>".$lang_offers['std_no_votes_yet']."</b></p>\n");
else
{
echo $pagertop;
print("<table border=1 cellspacing=0 cellpadding=5><tr><td class=colhead>".$lang_offers['col_user']."</td><td class=colhead align=left>".$lang_offers['col_vote']."</td>\n");
while ($arr = mysql_fetch_assoc($res))
{
if ($arr[vote] == 'yeah')
$vote = "<b><font color=green>".$lang_offers['text_for']."</font></b>";
elseif ($arr[vote] == 'against')
$vote = "<b><font color=red>".$lang_offers['text_against']."</font></b>";
else $vote = "unknown";
print("<tr><td class=rowfollow>" . get_username($arr['userid']) . "</td><td class=rowfollow align=left >".$vote."</td></tr>\n");
}
print("</table>\n");
echo $pagerbottom;
}
stdfoot();
die;
}
//=== end offer votes list
//=== offer votes
if (isset($_GET["vote"]) && $_GET["vote"]){
$offerid = htmlspecialchars(intval($_GET["id"] ?? 0));
$vote = htmlspecialchars($_GET["vote"]);
if ($vote == 'against' && get_user_class() < $againstoffer_class)
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
if ($vote =='yeah' || $vote =='against')
{
$userid = intval($CURUSER["id"] ?? 0);
$res = sql_query("SELECT * FROM offervotes WHERE offerid=".sqlesc($offerid)." AND userid=".sqlesc($userid)) or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
$voted = $arr;
$offer_userid = get_single_value("offers", "userid", "WHERE id=".sqlesc($offerid));
if ($offer_userid == $CURUSER['id'])
{
stderr($lang_offers['std_error'], $lang_offers['std_cannot_vote_youself']);
}
elseif ($voted)
{
stderr($lang_offers['std_already_voted'],$lang_offers['std_already_voted_note']."<a href=offers.php?id=$offerid&off_details=1>".$lang_offers['std_back_to_offer_detail'] ,false);
}
else
{
sql_query("UPDATE offers SET $vote = $vote + 1 WHERE id=".sqlesc($offerid)) or sqlerr(__FILE__,__LINE__);
$res = sql_query("SELECT users.username, offers.userid, offers.name FROM offers LEFT JOIN users ON offers.userid = users.id WHERE offers.id = ".sqlesc($offerid)) or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
$rs = sql_query("SELECT yeah, against, allowed FROM offers WHERE id=".sqlesc($offerid)) or sqlerr(__FILE__,__LINE__);
$ya_arr = mysql_fetch_assoc($rs);
$yeah = $ya_arr["yeah"];
$against = $ya_arr["against"];
$finishtime = date("Y-m-d H:i:s");
//allowed and send offer voted on message
if(($yeah-$against)>=$minoffervotes && $ya_arr['allowed'] != "allowed")
{
if ($offeruptimeout_main){
$timeouthour = floor($offeruptimeout_main/3600);
$timeoutnote = $lang_offers_target[get_user_lang($arr["userid"])]['msg_you_must_upload_in'].$timeouthour.$lang_offers_target[get_user_lang($arr["userid"])]['msg_hours_otherwise'];
}
else $timeoutnote = "";
sql_query("UPDATE offers SET allowed='allowed', allowedtime=".sqlesc($finishtime)." WHERE id=".sqlesc($offerid)) or sqlerr(__FILE__,__LINE__);
$msg = $lang_offers_target[get_user_lang($arr['userid'])]['msg_offer_voted_on']."[b][url=". get_protocol_prefix() . $BASEURL."/offers.php?id=$offerid&off_details=1]" . $arr[name] . "[/url][/b].". $lang_offers_target[get_user_lang($arr['userid'])]['msg_find_offer_option'].$timeoutnote;
$subject = $lang_offers_target[get_user_lang($arr['userid'])]['msg_your_offer_allowed'];
sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[userid], " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc($msg) . ", ".sqlesc($subject).")") or sqlerr(__FILE__, __LINE__);
write_log("System allowed offer $arr[name]",'normal');
}
//denied and send offer voted off message
if(($against-$yeah)>=$minoffervotes && $ya_arr['allowed'] != "denied")
{
sql_query("UPDATE offers SET allowed='denied' WHERE id=".sqlesc($offerid)) or sqlerr(__FILE__,__LINE__);
$msg = $lang_offers_target[get_user_lang($arr['userid'])]['msg_offer_voted_off']."[b][url=" . get_protocol_prefix() . $BASEURL."/offers.php?id=$offid&off_details=1]" . $arr[name] . "[/url][/b].".$lang_offers_target[get_user_lang($arr['userid'])]['msg_offer_deleted'] ;
$subject = $lang_offers_target[get_user_lang($arr['userid'])]['msg_offer_deleted'];
sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[userid], " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc($msg) . ", ".sqlesc($subject).")") or sqlerr(__FILE__, __LINE__);
write_log("System denied offer $arr[name]",'normal');
}
sql_query("INSERT INTO offervotes (offerid, userid, vote) VALUES($offerid, $userid, ".sqlesc($vote).")") or sqlerr(__FILE__,__LINE__);
KPS("+",$offervote_bonus,$CURUSER["id"]);
stdhead($lang_offers['head_vote_for_offer']);
print("<h1 align=center>".$lang_offers['std_vote_accepted']."</h1>");
print($lang_offers['std_vote_accepted_note']."<a href=offers.php?id=$offerid&off_details=1>".$lang_offers['std_back_to_offer_detail']);
stdfoot();
die;
}
}
else
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
//=== end offer votes
//=== delete offer
if (isset($_GET["del_offer"]) && $_GET["del_offer"]){
$del_offer = intval($_GET["del_offer"] ?? 0);
if($del_offer != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$offer = intval($_GET["id"] ?? 0);
$userid = intval($CURUSER["id"] ?? 0);
if (!is_valid_id($userid))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$res = sql_query("SELECT * FROM offers WHERE id = $offer") or sqlerr(__FILE__, __LINE__);
$num = mysql_fetch_array($res);
$name = $num["name"];
if ($userid != $num["userid"] && get_user_class() < $offermanage_class)
stderr($lang_offers['std_error'], $lang_offers['std_cannot_delete_others_offer']);
if ($_GET["sure"])
{
$sure = $_GET["sure"];
if($sure == '0' || $sure == '1')
$sure = intval($_GET["sure"] ?? 0);
else
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
if ($sure == 0)
stderr($lang_offers['std_delete_offer'], $lang_offers['std_delete_offer_note']."<br /><form method=post action=offers.php?id=$offer&del_offer=1&sure=1>".$lang_offers['text_reason_is']."<input type=text style=\"width: 200px\" name=reason><input type=submit value=\"".$lang_offers['submit_confirm']."\"></form>",false);
elseif ($sure == 1)
{
$reason = $_POST["reason"];
sql_query("DELETE FROM offers WHERE id=$offer");
sql_query("DELETE FROM offervotes WHERE offerid=$offer");
sql_query("DELETE FROM comments WHERE offer=$offer");
//===add karma //=== use this if you use the karma mod
//sql_query("UPDATE users SET seedbonus = seedbonus-10.0 WHERE id = $num[userid]") or sqlerr(__FILE__, __LINE__);
//===end
if ($CURUSER["id"] != $num["userid"])
{
$added = sqlesc(date("Y-m-d H:i:s"));
$subject = sqlesc($lang_offers_target[get_user_lang($num["userid"])]['msg_offer_deleted']);
$msg = sqlesc($lang_offers_target[get_user_lang($num["userid"])]['msg_your_offer'].$num[name].$lang_offers_target[get_user_lang($num["userid"])]['msg_was_deleted_by']. "[url=userdetails.php?id=".$CURUSER['id']."]".$CURUSER['username']."[/url]".$lang_offers_target[get_user_lang($num["userid"])]['msg_blank'].($reason != "" ? $lang_offers_target[get_user_lang($num["userid"])]['msg_reason_is'].$reason : ""));
sql_query("INSERT INTO messages (sender, receiver, msg, added, subject) VALUES(0, $num[userid], $msg, $added, $subject)") or sqlerr(__FILE__, __LINE__);
}
write_log("Offer: $offer ($num[name]) was deleted by $CURUSER[username]".($reason != "" ? " (".$reason.")" : ""),'normal');
header("Refresh: 0; url=offers.php");
die;
}
else
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
//== end delete offer
//=== prolly not needed, but what the hell... basically stopping the page getting screwed up
$sort = '';
if (isset($_GET["sort"]) && $_GET["sort"])
{
$sort = $_GET["sort"];
if($sort == 'cat' || $sort == 'name' || $sort == 'added' || $sort == 'comments' || $sort == 'yeah' || $sort == 'against' || $sort == 'v_res')
$sort = $_GET["sort"];
else
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
//=== end of prolly not needed, but what the hell :P
$categ = intval($_GET["category"] ?? 0);
$offerorid = 0;
if (isset($_GET["offerorid"]) && $_GET["offerorid"]){
$offerorid = htmlspecialchars(intval($_GET["offerorid"] ?? 0));
if (preg_match("/^[0-9]+$/", !$offerorid))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
$search = ($_GET["search"] ?? '');
if ($search) {
$search = " AND offers.name like ".sqlesc("%$search%");
} else {
$search = "";
}
$cat_order_type = "desc";
$name_order_type = "desc";
$added_order_type = "desc";
$comments_order_type = "desc";
$v_res_order_type = "desc";
/*
if ($cat_order_type == "") { $sort = " ORDER BY added " . $added_order_type; $cat_order_type = "asc"; } // for torrent name
if ($name_order_type == "") { $sort = " ORDER BY added " . $added_order_type; $name_order_type = "desc"; }
if ($added_order_type == "") { $sort = " ORDER BY added " . $added_order_type; $added_order_type = "desc"; }
if ($comments_order_type == "") { $sort = " ORDER BY added " . $added_order_type; $comments_order_type = "desc"; }
if ($v_res_order_type == "") { $sort = " ORDER BY added " . $added_order_type; $v_res_order_type = "desc"; }
*/
if ($sort == "cat")
{
if ($_GET['type'] == "desc")
$cat_order_type = "asc";
$sort = " ORDER BY category ". $cat_order_type;
}
else if ($sort == "name")
{
if ($_GET['type'] == "desc")
$name_order_type = "asc";
$sort = " ORDER BY name ". $name_order_type;
}
else if ($sort == "added")
{
if ($_GET['type'] == "desc")
$added_order_type = "asc";
$sort = " ORDER BY added " . $added_order_type;
}
else if ($sort == "comments")
{
if ($_GET['type'] == "desc")
$comments_order_type = "asc";
$sort = " ORDER BY comments " . $comments_order_type;
}
else if ($sort == "v_res")
{
if ($_GET['type'] == "desc")
$v_res_order_type = "asc";
$sort = " ORDER BY (yeah - against) " . $v_res_order_type;
}
if ($offerorid <> NULL)
{
if (($categ <> NULL) && ($categ <> 0))
$categ = "WHERE offers.category = " . $categ . " AND offers.userid = " . $offerorid;
else
$categ = "WHERE offers.userid = " . $offerorid;
}
else if ($categ == 0)
$categ = '';
else
$categ = "WHERE offers.category = " . $categ;
$res = sql_query("SELECT count(offers.id) FROM offers inner join categories on offers.category = categories.id inner join users on offers.userid = users.id $categ $search") or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_array($res);
$count = $row[0];
$perpage = 25;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] ."?" . "category=" . ($_GET["category"] ?? '') . "&sort=" . ($_GET["sort"] ?? '') . "&" );
//stderr("", $sort);
if($sort == "")
$sort = "ORDER BY added desc ";
$res = sql_query("SELECT offers.id, offers.userid, offers.name, offers.added, offers.allowedtime, offers.comments, offers.yeah, offers.against, offers.category as cat_id, offers.allowed, categories.image, categories.name as cat FROM offers inner join categories on offers.category = categories.id $categ $search $sort $limit") or sqlerr(__FILE__,__LINE__);
$num = mysql_num_rows($res);
stdhead($lang_offers['head_offers']);
begin_main_frame();
begin_frame($lang_offers['text_offers_section'], true,10,"100%","center");
print("<p align=\"left\"><b><font size=\"5\">".$lang_offers['text_rules']."</font></b></p>\n");
print("<div align=\"left\"><ul>");
print("<li>".$lang_offers['text_rule_one_one'].get_user_class_name($upload_class, false, true, true).$lang_offers['text_rule_one_two'].get_user_class_name($addoffer_class, false, true, true).$lang_offers['text_rule_one_three']."</li>\n");
print("<li>".$lang_offers['text_rule_two_one']."<b>".$minoffervotes."</b>".$lang_offers['text_rule_two_two']."</li>\n");
if ($offervotetimeout_main)
print("<li>".$lang_offers['text_rule_three_one']."<b>".($offervotetimeout_main / 3600)."</b>".$lang_offers['text_rule_three_two']."</li>\n");
if ($offeruptimeout_main)
print("<li>".$lang_offers['text_rule_four_one']."<b>".($offeruptimeout_main / 3600)."</b>".$lang_offers['text_rule_four_two']."</li>\n");
print("</ul></div>");
if (get_user_class() >= $addoffer_class)
print("<div align=\"center\" style=\"margin-bottom: 8px;\"><a href=\"?add_offer=1\">".
"<b>".$lang_offers['text_add_offer']."</b></a></div>");
print("<div align=\"center\"><form method=\"get\" action=\"?\">".$lang_offers['text_search_offers']."&nbsp;&nbsp;<input type=\"text\" id=\"specialboxg\" name=\"search\" />&nbsp;&nbsp;");
$cats = genrelist($browsecatmode);
$catdropdown = "";
foreach ($cats as $cat) {
$catdropdown .= "<option value=\"" . $cat["id"] . "\"";
$catdropdown .= ">" . htmlspecialchars($cat["name"]) . "</option>\n";
}
print("<select name=\"category\"><option value=\"0\">".$lang_offers['select_show_all']."</option>".$catdropdown."</select>&nbsp;&nbsp;<input type=\"submit\" class=\"btn\" value=\"".$lang_offers['submit_search']."\" /></form></div>");
end_frame();
print("<br /><br />");
$last_offer = strtotime($CURUSER['last_offer']);
if (!$num)
stdmsg($lang_offers['text_nothing_found'],$lang_offers['text_nothing_found']);
else
{
$catid = $_GET[category];
print("<table class=\"torrents\" cellspacing=\"0\" cellpadding=\"5\" width=\"100%\">");
print("<tr><td class=\"colhead\" style=\"padding: 0px\"><a href=\"?category=" . $catid . "&amp;sort=cat&amp;type=".$cat_order_type."\">".$lang_offers['col_type']."</a></td>".
"<td class=\"colhead\" width=\"100%\"><a href=\"?category=" . $catid . "&amp;sort=name&amp;type=".$name_order_type."\">".$lang_offers['col_title']."</a></td>".
"<td colspan=\"3\" class=\"colhead\"><a href=\"?category=" . $catid . "&amp;sort=v_res&amp;type=".$v_res_order_type."\">".$lang_offers['col_vote_results']."</a></td>".
"<td class=\"colhead\"><a href=\"?category=" . $catid . "&amp;sort=comments&amp;type=".$comments_order_type."\"><img class=\"comments\" src=\"pic/trans.gif\" alt=\"comments\" title=\"".$lang_offers['title_comment']."\" />".$lang_offers['col_comment']."</a></td>".
"<td class=\"colhead\"><a href=\"?category=" . $catid . "&amp;sort=added&amp;type=".$added_order_type."\"><img class=\"time\" src=\"pic/trans.gif\" alt=\"time\" title=\"".$lang_offers['title_time_added']."\" /></a></td>");
if ($offervotetimeout_main > 0 && $offeruptimeout_main > 0)
print("<td class=\"colhead\">".$lang_offers['col_timeout']."</td>");
print("<td class=\"colhead\">".$lang_offers['col_offered_by']."</td>".
(get_user_class() >= $offermanage_class ? "<td class=\"colhead\">".$lang_offers['col_act']."</td>" : "")."</tr>\n");
for ($i = 0; $i < $num; ++$i)
{
$arr = mysql_fetch_assoc($res);
$addedby = get_username($arr['userid']);
$comms = $arr['comments'];
if ($comms == 0)
$comment = "<a href=\"comment.php?action=add&amp;pid=".$arr[id]."&amp;type=offer\" title=\"".$lang_offers['title_add_comments']."\">0</a>";
else
{
if (!$lastcom = $Cache->get_value('offer_'.$arr[id].'_last_comment_content')){
$res2 = sql_query("SELECT user, added, text FROM comments WHERE offer = $arr[id] ORDER BY added DESC LIMIT 1");
$lastcom = mysql_fetch_array($res2);
$Cache->cache_value('offer_'.$arr[id].'_last_comment_content', $lastcom, 1855);
}
$timestamp = strtotime($lastcom["added"]);
$hasnewcom = ($lastcom['user'] != $CURUSER['id'] && $timestamp >= $last_offer);
if ($CURUSER['showlastcom'] != 'no')
{
if ($lastcom)
{
$title = "";
if ($CURUSER['timetype'] != 'timealive')
$lastcomtime = $lang_offers['text_at_time'].$lastcom['added'];
else
$lastcomtime = $lang_offers['text_blank'].gettime($lastcom["added"],true,false,true);
$counter = $i;
$lastcom_tooltip[$counter]['id'] = "lastcom_" . $counter;
$lastcom_tooltip[$counter]['content'] = ($hasnewcom ? "<b>(<font class='new'>".$lang_offers['text_new']."</font>)</b> " : "").$lang_offers['text_last_commented_by'].get_username($lastcom['user']) . $lastcomtime."<br />". format_comment(mb_substr($lastcom['text'],0,100,"UTF-8") . (mb_strlen($lastcom['text'],"UTF-8") > 100 ? " ......" : "" ),true,false,false,true,600,false,false);
$onmouseover = "onmouseover=\"domTT_activate(this, event, 'content', document.getElementById('" . $lastcom_tooltip[$counter]['id'] . "'), 'trail', false, 'delay', 500,'lifetime',3000,'fade','both','styleClass','niceTitle','fadeMax', 87,'maxWidth', 400);\"";
}
}
else
{
$title = " title=\"".($hasnewcom ? $lang_offers['title_has_new_comment'] : $lang_offers['title_no_new_comment'])."\"";
$onmouseover = "";
}
$comment = "<b><a".$title." href=\"?id=".$arr[id]."&amp;off_details=1#startcomments\" ".$onmouseover.">".($hasnewcom ? "<font class='new'>" : ""). $comms .($hasnewcom ? "</font>" : "")."</a></b>";
}
//==== if you want allow deny for offers use this next bit
if ($arr["allowed"] == 'allowed')
$allowed = "&nbsp;<b>[<font color=\"green\">".$lang_offers['text_allowed']."</font>]</b>";
elseif ($arr["allowed"] == 'denied')
$allowed = "&nbsp;<b>[<font color=\"red\">".$lang_offers['text_denied']."</font>]</b>";
else
$allowed = "&nbsp;<b>[<font color=\"orange\">".$lang_offers['text_pending']."</font>]</b>";
//===end
if ($arr["yeah"] == 0)
$zvote = $arr[yeah];
else
$zvote = "<b><a href=\"?id=".$arr[id]."&amp;offer_vote=1\">".$arr[yeah]."</a></b>";
if ($arr["against"] == 0)
$pvote = "$arr[against]";
else
$pvote = "<b><a href=\"?id=".$arr[id]."&amp;offer_vote=1\">".$arr[against]."</a></b>";
if ($arr["yeah"] == 0 && $arr["against"] == 0)
{
$v_res = "0";
}
else
{
$v_res = "<b><a href=\"?id=".$arr[id]."&amp;offer_vote=1\" title=\"".$lang_offers['title_show_vote_details']."\"><font color=\"green\">" .$arr[yeah]."</font> - <font color=\"red\">".$arr[against]."</font> = ".($arr[yeah] - $arr[against]). "</a></b>";
}
$addtime = gettime($arr['added'],false,true);
$dispname = $arr[name];
$count_dispname=mb_strlen($arr[name],"UTF-8");
$max_length_of_offer_name = 70;
if($count_dispname > $max_length_of_offer_name)
$dispname=mb_substr($dispname, 0, $max_length_of_offer_name-2,"UTF-8") . "..";
print("<tr><td class=\"rowfollow\" style=\"padding: 0px\"><a href=\"?category=".$arr['cat_id']."\">".return_category_image($arr['cat_id'], "")."</a></td><td style='text-align: left'><a href=\"?id=".$arr[id]."&amp;off_details=1\" title=\"".htmlspecialchars($arr[name])."\"><b>".htmlspecialchars($dispname)."</b></a>".($CURUSER['appendnew'] != 'no' && strtotime($arr["added"]) >= $last_offer ? "<b> (<font class='new'>".$lang_offers['text_new']."</font>)</b>" : "").$allowed."</td><td class=\"rowfollow nowrap\" style='padding: 5px' align=\"center\">".$v_res."</td><td class=\"rowfollow nowrap\" ".(get_user_class() < $againstoffer_class ? " colspan=\"2\" " : "")." style='padding: 5px'><a href=\"?id=".$arr[id]."&amp;vote=yeah\" title=\"".$lang_offers['title_i_want_this']."\"><font color=\"green\"><b>".$lang_offers['text_yep']."</b></font></a></td>".(get_user_class() >= $againstoffer_class ? "<td class=\"rowfollow nowrap\" align=\"center\"><a href=\"?id=".$arr[id]."&amp;vote=against\" title=\"".$lang_offers['title_do_not_want_it']."\"><font color=\"red\"><b>".$lang_offers['text_nah']."</b></font></a></td>" : ""));
print("<td class=\"rowfollow\">".$comment."</td><td class=\"rowfollow nowrap\">" . $addtime. "</td>");
if ($offervotetimeout_main > 0 && $offeruptimeout_main > 0){
if ($arr["allowed"] == 'allowed'){
$futuretime = strtotime($arr['allowedtime']) + $offeruptimeout_main;
$timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, true, true, false, true);
}
elseif ($arr["allowed"] == 'pending')
{
$futuretime = strtotime($arr['added']) + $offervotetimeout_main;
$timeout = gettime(date("Y-m-d H:i:s",$futuretime), false, true, true, false, true);
}
if (!$timeout)
$timeout = "N/A";
print("<td class=\"rowfollow nowrap\">".$timeout."</td>");
}
print("<td class=\"rowfollow\">".$addedby."</td>".(get_user_class() >= $offermanage_class ? "<td class=\"rowfollow\"><a href=\"?id=".$arr[id]."&amp;del_offer=1\"><img class=\"staff_delete\" src=\"pic/trans.gif\" alt=\"D\" title=\"".$lang_offers['title_delete']."\" /></a><br /><a href=\"?id=".$arr[id]."&amp;edit_offer=1\"><img class=\"staff_edit\" src=\"pic/trans.gif\" alt=\"E\" title=\"".$lang_offers['title_edit']."\" /></a></td>" : "")."</tr>");
}
print("</table>\n");
echo $pagerbottom;
if(!isset($CURUSER) || $CURUSER['showlastcom'] == 'yes')
create_tooltip_container($lastcom_tooltip, 400);
}
end_main_frame();
$USERUPDATESET[] = "last_offer = ".sqlesc(date("Y-m-d H:i:s"));
stdfoot();
?>
+60
View File
@@ -0,0 +1,60 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
if (!mkglobal("type"))
die();
if ($type == "adminactivate")
{
stdhead($lang_ok['head_user_signup']);
stdmsg($lang_ok['std_account_activated'],
$lang_ok['account_activated_note']);
}
elseif ($type == "inviter")
{
stdhead($lang_ok['head_user_signup']);
stdmsg($lang_ok['std_account_activated'],
$lang_ok['account_activated_note_two']);
}
elseif ($type == "signup" && mkglobal("email"))
{
stdhead($lang_ok['head_user_signup']);
stdmsg($lang_ok['std_signup_successful'],
$lang_ok['std_confirmation_email_note']. htmlspecialchars($email) . $lang_ok['std_confirmation_email_note_end']);
stdfoot();
}
elseif ($type == "sysop") {
stdhead($lang_ok['head_sysop_activation']);
print($lang_ok['std_sysop_activation_note']);
if (isset($CURUSER))
print($lang_ok['std_auto_logged_in_note']);
else
print($lang_ok['std_cookies_disabled_note']);
stdfoot();
}
elseif ($type == "confirmed") {
stdhead($lang_ok['head_already_confirmed']);
print($lang_ok['std_already_confirmed']);
print($lang_ok['std_already_confirmed_note']);
stdfoot();
}
elseif ($type == "confirm") {
if (isset($CURUSER)) {
stdhead($lang_ok['head_signup_confirmation']);
print($lang_ok['std_account_confirmed']);
print($lang_ok['std_auto_logged_in_note']);
print($lang_ok['std_read_rules_faq']);
stdfoot();
}
else {
stdhead($lang_ok['head_signup_confirmation']);
print($lang_ok['std_account_confirmed']);
print($lang_ok['std_cookies_disabled_note']);
stdfoot();
}
}
else
die();
?>
+57
View File
@@ -0,0 +1,57 @@
<?php
require "../include/bittorrent.php";
dbconn();
function data_url($file, $mime)
{
$contents = file_get_contents($file);
$base64 = base64_encode($contents);
return ('data:' . $mime . ';base64,' . $base64);
}
$url = get_protocol_prefix().$BASEURL;
$year = substr($datefounded, 0, 4);
$yearfounded = ($year ? $year : 2007);
$attribution = "Copyright (c) ".$SITENAME." ".(date("Y") != $yearfounded ? $yearfounded."-" : "").date("Y").", all rights reserved";
header ("Content-type: text/xml");
$Cache->new_page('opensearch_description', 86400);
if (!$Cache->get_page()){
$Cache->add_whole_row();
print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName><?php echo $SITENAME?> Torrents</ShortName>
<Description>Search Torrents at <?php echo $SITENAME?> - <?php echo htmlspecialchars($SLOGAN)?>.</Description>
<Url type="text/html"
rel="results"
pageOffset="0"
template="<?php echo $url?>/torrents.php?search={searchTerms}&amp;page={startPage?}" />
<Url type="application/rss+xml"
rel="results"
indexOffset="0"
template="<?php echo $url?>/torrentrss.php?search={searchTerms}&amp;rows={count?}&amp;startindex={startIndex?}" />
<Url type="application/opensearchdescription+xml"
rel="self"
template="<?php echo $url?>/opensearch.php" />
<Url type="application/x-suggestions+json"
rel="suggestions"
template="<?php echo $url?>/searchsuggest.php?q={searchTerms}" />
<Contact><?php echo $SITEEMAIL?></Contact>
<Tags>Torrents <?php echo PROJECTNAME?></Tags>
<LongName><?php echo $SITENAME?> Torrents Search</LongName>
<Image height="32" width="32" type="image/x-icon"><?php echo data_url('favicon.ico', 'image/x-icon')?></Image>
<Image height="32" width="32" type="image/x-icon"><?php echo $url?>/favicon.ico</Image>
<moz:SearchForm><?php echo $url?>/torrents.php</moz:SearchForm>
<Query role="example" searchTerms="batman" />
<Developer><?php echo $SITENAME?> Staff</Developer>
<Attribution><?php echo $attribution?></Attribution>
<SyndicationRight>limited</SyndicationRight>
<Language>*</Language>
<InputEncoding>UTF-8</InputEncoding>
<OutputEncoding>UTF-8</OutputEncoding>
</OpenSearchDescription>
<?php
$Cache->end_whole_row();
$Cache->cache_page();
}
echo $Cache->next_row();
?>
+3
View File
@@ -0,0 +1,3 @@
Options -Indexes
Order allow,deny
Allow from all
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Some files were not shown because too many files have changed in this diff Show More