fix_announce_warning

This commit is contained in:
xiaomlove
2021-01-20 20:06:48 +08:00
parent b3d99612a1
commit d5c4166c91
9 changed files with 24 additions and 39 deletions
+4 -2
View File
@@ -73,9 +73,11 @@ foreach ($settings as $name => $value) {
}
$SITENAME = $BASIC['SITENAME'];
$BASEURL = $BASIC['BASEURL'];
//$BASEURL = $BASIC['BASEURL'];
$BASEURL = $_SERVER['HTTP_HOST'];
$announce_urls = array();
$announce_urls[] = $BASIC['announce_url'];
//$announce_urls[] = $BASIC['announce_url'];
$announce_urls[] = $BASEURL . '/announce.php';
$SITE_ONLINE = $MAIN['site_online'];
$max_torrent_size = $MAIN['max_torrent_size'];
+1 -3
View File
@@ -3,6 +3,7 @@ if(!defined('IN_TRACKER')) {
die('Hacking attempt!');
}
error_reporting(E_ALL);
ini_set('display_errors', 0);
if (!empty($_SERVER['HTTP_X_REQUEST_ID'])) {
define('REQUEST_ID', $_SERVER['HTTP_X_REQUEST_ID']);
} else {
@@ -23,9 +24,6 @@ require $rootpath . 'include/config.php';
if (!IS_ANNOUNCE) {
require $rootpath . get_langfile_path("functions.php");
}
ini_set('display_errors', $TWEAK['display_errors']);
$Cache = new RedisCache(); //Load the caching class
$Cache->setLanguageFolderArray(get_langfolder_list());
define('TIMENOW', time());
+2 -2
View File
@@ -55,7 +55,7 @@ function benc_resp($d)
benc_resp_raw(benc(array('type' => 'dictionary', 'value' => $d)));
}
function benc_resp_raw($x) {
do_log($x);
header("Content-Type: text/plain; charset=utf-8");
header("Pragma: no-cache");
@@ -318,7 +318,7 @@ function check_client($peer_id, $agent, &$agent_familyid)
$agent_familyid = $row_allowed_ua['id'];
}
if($_SERVER["HTTPS"] == "on")
if(isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on")
{
if($allow_https == 'yes')
return 0;
+1 -1
View File
@@ -80,7 +80,7 @@ function sql_query($query)
function sqlesc($value) {
if (is_null($value)) {
return null;
return 'null';
}
$value = "'" . mysql_real_escape_string($value) . "'";
return $value;
+1 -3
View File
@@ -508,7 +508,7 @@ $lang_settings = array
'head_website_settings' => "站点设定",
'row_basic_settings' => "基础设定",
'submit_basic_settings' => "基础设定",
'text_basic_settings_note' => "设定最基础的项目,如数据库,网站名等。如果对设定项目的功能不清楚,请<font class=striking><b>不要</b></font>做任何修改。<br />基础设定出错可能导致<b>网站无法运行</b>",
'text_basic_settings_note' => "设定最基础的项目,网站名等",
'row_main_settings' => "主要设定",
'submit_main_settings' => "主要设定",
'text_main_settings_note' => "配置你的网站各种主要项目。",
@@ -682,8 +682,6 @@ $lang_settings = array
'text_invitations_default' => "个邀请名额。默认",
'row_use_cron_trigger_cleanup' => '使用定时器进行清理',
'text_use_cron_trigger_cleanup_note' => '确保已经配置好定时任务',
'row_display_errors' => '显示错误',
'text_display_errors_note' => '在网页上展示错误信息',
'row_logging' => '运行日志路径',
'text_logging_note' => '请填写你的运行时日志路径',
);
+1 -3
View File
@@ -509,7 +509,7 @@ $lang_settings = array
'head_website_settings' => "網站設定",
'row_basic_settings' => "基礎設定",
'submit_basic_settings' => "基礎設定",
'text_basic_settings_note' => "設定最基礎的項目,如資料程式庫,網站名等。如果對設定項目的功能不清楚,請<font class=striking><b>不要</b></font>做任何修改。<br />基礎設定出錯可能導致<b>網站無法執行</b>",
'text_basic_settings_note' => "設定最基礎的項目,網站名等",
'row_main_settings' => "主要設定",
'submit_main_settings' => "主要設定",
'text_main_settings_note' => "配置你的網站各種主要項目。",
@@ -682,8 +682,6 @@ $lang_settings = array
'text_invitations_default' => "個邀請名額。預設",
'row_use_cron_trigger_cleanup' => '使用定時器進行清理',
'text_use_cron_trigger_cleanup_note' => '確保已經配置好定時任務',
'row_display_errors' => '顯示錯誤',
'text_display_errors_note' => '在網頁上展示錯誤信息',
'row_logging' => '運行日誌路徑',
'text_logging_note' => '請填寫妳的運行時日誌路徑',
);
+1 -3
View File
@@ -508,7 +508,7 @@ $lang_settings = array
'head_website_settings' => "Website Settings",
'row_basic_settings' => "Basic Settings",
'submit_basic_settings' => "Basic Settings",
'text_basic_settings_note' => "Setup the most basic things, e.g. database, site name. <font class=striking><b>DO NOT</b></font> touch this unless you know what you are doing! <br />Misconfiguration of Basic Settings may result in <b>AN UNUSABLE SITE</b>.",
'text_basic_settings_note' => "Setup the most basic things, site name.",
'row_main_settings' => "Main Settings",
'submit_main_settings' => "Main Settings",
'text_main_settings_note' => "Setup miscellaneous things about your site.",
@@ -682,8 +682,6 @@ $lang_settings = array
'text_invitations_default' => " invitations the first time he is promoted to this class. Default ",
'row_use_cron_trigger_cleanup' => 'Use cron trigger cleanup',
'text_use_cron_trigger_cleanup_note' => 'Make sure have configure crontab job',
'row_display_errors' => 'Display errors',
'text_display_errors_note' => 'Display errors message on page',
'row_logging' => 'Runtime log path',
'text_logging_note' => 'Please enter your runtime log path',
);
+5 -2
View File
@@ -2,6 +2,8 @@
require_once('../include/bittorrent_announce.php');
require_once('../include/benc.php');
dbconn_announce();
do_log(json_encode($_SERVER));
$log = "";
//1. BLOCK ACCESS WITH WEB BROWSERS AND CHEATS!
$agent = $_SERVER["HTTP_USER_AGENT"];
block_browser();
@@ -9,7 +11,7 @@ block_browser();
// 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"]))
if(isset($_GET[$x]))
$GLOBALS[$x] = $_GET[$x];
}
// get integer type port, downloaded, uploaded, left from client
@@ -331,10 +333,11 @@ if (isset($self) && $event == "stopped")
}
elseif(isset($self))
{
$finished = $finished_snatched = '';
if ($event == "completed")
{
//sql_query("UPDATE snatched SET finished = 'yes', completedat = $dt WHERE torrentid = $torrentid AND userid = $userid");
$finished = ", finishedat = ".TIMENOW;
$finished .= ", finishedat = ".TIMENOW;
$finished_snatched = ", completedat = ".$dt . ", finished = 'yes'";
$updateset[] = "times_completed = times_completed + 1";
}
+8 -20
View File
@@ -44,6 +44,7 @@ $notice = "<h1 align=\"center\"><a class=\"faqlink\" href=\"settings.php\">".$la
if ($action == 'savesettings_main') // save main
{
do_log(json_encode($_REQUEST));
stdhead($lang_settings['head_save_main_settings']);
$validConfig = array(
'site_online','max_torrent_size','announce_interval', 'annintertwoage', 'annintertwo', 'anninterthreeage', 'anninterthree', 'signup_timeout',
@@ -62,7 +63,6 @@ if ($action == 'savesettings_main') // save main
$MAIN[$config] = $$config ?? null;
}
// WriteConfig('MAIN', $MAIN);
saveSetting('main', $MAIN);
$Cache->delete_value('recent_news', true);
$Cache->delete_value('stats_users', true);
@@ -76,14 +76,13 @@ elseif ($action == 'savesettings_basic') // save basic
{
stdhead($lang_settings['head_save_basic_settings']);
$validConfig = array(
'SITENAME', 'BASEURL', 'announce_url',
'SITENAME',
);
GetVar($validConfig);
$BASIC = [];
foreach($validConfig as $config) {
$BASIC[$config] = $$config ?? null;
}
// WriteConfig('BASIC', $BASIC);
saveSetting('basic', $BASIC);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker basic settings updated by $CURUSER[username]. $actiontime",'mod');
@@ -98,7 +97,6 @@ elseif ($action == 'savesettings_code') // save database
foreach($validConfig as $config) {
$CODE[$config] = $$config ?? null;
}
// WriteConfig('CODE', $CODE);
saveSetting('code', $CODE);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker code settings updated by $CURUSER[username]. $actiontime",'mod');
@@ -113,7 +111,6 @@ elseif ($action == 'savesettings_bonus') // save bonus
foreach($validConfig as $config) {
$BONUS[$config] = $$config ?? null;
}
// WriteConfig('BONUS', $BONUS);
saveSetting('bonus', $BONUS);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker bonus settings updated by $CURUSER[username]. $actiontime",'mod');
@@ -129,7 +126,6 @@ elseif ($action == 'savesettings_account') // save account
foreach($validConfig as $config) {
$ACCOUNT[$config] = $$config ?? null;
}
// WriteConfig('ACCOUNT', $ACCOUNT);
saveSetting('account', $ACCOUNT);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker account settings updated by $CURUSER[username]. $actiontime",'mod');
@@ -145,7 +141,6 @@ elseif($action == 'savesettings_torrent') // save account
$TORRENT[$config] = $$config ?? null;
}
// WriteConfig('TORRENT', $TORRENT);
saveSetting('torrent', $TORRENT);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker torrent settings updated by $CURUSER[username]. $actiontime",'mod');
@@ -167,7 +162,6 @@ elseif ($action == 'savesettings_smtp') // save smtp
foreach($validConfig as $config) {
$SMTP[$config] = $$config ?? null;
}
// WriteConfig('SMTP', $SMTP);
saveSetting('smtp', $SMTP);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker SMTP settings updated by $CURUSER[username]. $actiontime",'mod');
@@ -182,7 +176,6 @@ elseif ($action == 'savesettings_security') // save security
foreach($validConfig as $config) {
$SECURITY[$config] = $$config ?? null;
}
// WriteConfig('SECURITY', $SECURITY);
saveSetting('security', $SECURITY);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker SECURITY settings updated by $CURUSER[username]. $actiontime",'mod');
@@ -198,7 +191,6 @@ elseif ($action == 'savesettings_authority') // save user authority
$AUTHORITY[$config] = $$config ?? null;
}
// WriteConfig('AUTHORITY', $AUTHORITY);
saveSetting('authority', $AUTHORITY);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker USER AUTHORITY settings updated by $CURUSER[username]. $actiontime",'mod');
@@ -207,13 +199,12 @@ elseif ($action == 'savesettings_authority') // save user authority
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', 'display_errors', 'logging');
$validConfig = array('where','iplog1','bonus','datefounded', 'enablelocation', 'titlekeywords', 'metakeywords', 'metadescription', 'enablesqldebug', 'sqldebug', 'cssdate', 'enabletooltip', 'prolinkimg', 'analyticscode', 'logging');
GetVar($validConfig);
$TWEAK = [];
foreach($validConfig as $config) {
$TWEAK[$config] = $$config ?? null;
}
// WriteConfig('TWEAK', $TWEAK);
saveSetting('tweak', $TWEAK);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker TWEAK settings updated by $CURUSER[username]. $actiontime",'mod');
@@ -229,7 +220,6 @@ elseif ($action == 'savesettings_attachment') // save attachment
$ATTACHMENT[$config] = $$config ?? null;
}
// WriteConfig('ATTACHMENT', $ATTACHMENT);
saveSetting('attachment', $ATTACHMENT);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker ATTACHMENT settings updated by $CURUSER[username]. $actiontime",'mod');
@@ -245,7 +235,6 @@ elseif ($action == 'savesettings_advertisement') // save advertisement
$ADVERTISEMENT[$config] = $$config ?? null;
}
// WriteConfig('ADVERTISEMENT', $ADVERTISEMENT);
saveSetting('advertisement', $ADVERTISEMENT);
$actiontime = date("F j, Y, g:i a");
write_log("Tracker ADVERTISEMENT settings updated by $CURUSER[username]. $actiontime",'mod');
@@ -270,7 +259,6 @@ elseif ($action == 'tweaksettings') // tweak settings
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);
yesorno($lang_settings['row_display_errors'], 'display_errors', $TWEAK["display_errors"], $lang_settings['text_display_errors_note']);
tr($lang_settings['row_logging'],"<input type='text' style=\"width: 300px\" name=logging value='".($TWEAK["logging"] ? $TWEAK["logging"] : '')."'> <br />".$lang_settings['text_logging_note'], 1);
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
@@ -388,8 +376,8 @@ elseif ($action == 'basicsettings') // basic settings
$config = get_setting('basic');
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='".($config["SITENAME"] ? $config["SITENAME"]: "Nexus")."'> ".$lang_settings['text_site_name_note'], 1);
tr($lang_settings['row_base_url'],"<input type='text' style=\"width: 300px\" name=BASEURL value='".($config["BASEURL"] ? $config["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='".($config["announce_url"] ? $config["announce_url"] : $_SERVER["HTTP_HOST"]."/announce.php")."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"]."/announce.php", 1);
// tr($lang_settings['row_base_url'],"<input type='text' style=\"width: 300px\" name=BASEURL value='".($config["BASEURL"] ? $config["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='".($config["announce_url"] ? $config["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='".($config["mysql_host"] ? $config["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='".($config["mysql_user"] ? $config["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);
@@ -595,13 +583,13 @@ elseif ($action == 'mainsettings') // main settings
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")
// 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")
// 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);
@@ -613,7 +601,7 @@ elseif ($action == 'mainsettings') // main settings
$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")
// 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 = "";