fix announce for directory change

This commit is contained in:
xiaomlove
2021-01-19 21:50:21 +08:00
parent a5eaad9036
commit b3d99612a1
15 changed files with 29 additions and 26 deletions
-1
View File
@@ -12,7 +12,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . $rootpath);
$rootpath .= "/"; $rootpath .= "/";
require $rootpath . 'include/functions.php'; require $rootpath . 'include/functions.php';
require $rootpath . 'include/globalfunctions.php'; require $rootpath . 'include/globalfunctions.php';
require $rootpath . get_langfile_path("functions.php");
require $rootpath . 'include/core.php'; require $rootpath . 'include/core.php';
+1 -2
View File
@@ -62,7 +62,7 @@ if (file_exists('config/allconfig.php')) {
*/ */
//load settings from database //load settings from database
if (basename($_SERVER['SCRIPT_FILENAME']) == 'announce.php') { if (IS_ANNOUNCE) {
dbconn_announce(); dbconn_announce();
} else { } else {
dbconn(); dbconn();
@@ -408,4 +408,3 @@ $useCronTriggerCleanUp = $MAIN['use_cron_trigger_cleanup'];
//some promotion rules //some promotion rules
//$promotionrules_torrent = array(0 => array("mediumid" => array(1), "promotion" => 5), 1 => array("mediumid" => array(3), "promotion" => 5), 2 => array("catid" => array(402), "standardid" => array(3), "promotion" => 4), 3 => array("catid" => array(403), "standardid" => array(3), "promotion" => 4)); //$promotionrules_torrent = array(0 => array("mediumid" => array(1), "promotion" => 5), 1 => array("mediumid" => array(3), "promotion" => 5), 2 => array("catid" => array(402), "standardid" => array(3), "promotion" => 4), 3 => array("catid" => array(403), "standardid" => array(3), "promotion" => 4));
$promotionrules_torrent = array(); $promotionrules_torrent = array();
?>
+4
View File
@@ -9,6 +9,7 @@ if (!empty($_SERVER['HTTP_X_REQUEST_ID'])) {
define('REQUEST_ID', intval(NEXUS_START * 10000)); define('REQUEST_ID', intval(NEXUS_START * 10000));
} }
define('ROOT_PATH', $rootpath); define('ROOT_PATH', $rootpath);
define('IS_ANNOUNCE', (basename($_SERVER['SCRIPT_FILENAME']) == 'announce.php'));
require $rootpath . 'include/database/interface_db.php'; require $rootpath . 'include/database/interface_db.php';
require $rootpath . 'include/database/class_db_mysqli.php'; require $rootpath . 'include/database/class_db_mysqli.php';
@@ -19,6 +20,9 @@ require $rootpath . 'include/database/class_exception.php';
require $rootpath . 'classes/class_advertisement.php'; require $rootpath . 'classes/class_advertisement.php';
require $rootpath . 'classes/class_cache_redis.php'; require $rootpath . 'classes/class_cache_redis.php';
require $rootpath . 'include/config.php'; require $rootpath . 'include/config.php';
if (!IS_ANNOUNCE) {
require $rootpath . get_langfile_path("functions.php");
}
ini_set('display_errors', $TWEAK['display_errors']); ini_set('display_errors', $TWEAK['display_errors']);
+3 -1
View File
@@ -2703,7 +2703,9 @@ function get_langid_from_langcookie()
function make_folder($pre, $folder_name) function make_folder($pre, $folder_name)
{ {
$path = $pre . $folder_name; $path = $pre . $folder_name;
if(!file_exists($path)) $path = ROOT_PATH . ltrim($path, './');
do_log($path);
if(!is_dir($path))
mkdir($path,0777,true); mkdir($path,0777,true);
return $path; return $path;
} }
+2 -2
View File
@@ -42,7 +42,7 @@ function block_browser()
//else //else
// $headers = emu_getallheaders(); // $headers = emu_getallheaders();
if($_SERVER["HTTPS"] != "on") if(isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] != "on")
{ {
if (isset($headers["Cookie"]) || isset($headers["Accept-Language"]) || isset($headers["Accept-Charset"])) if (isset($headers["Cookie"]) || isset($headers["Accept-Language"]) || isset($headers["Accept-Charset"]))
err("Anti-Cheater: You cannot use this agent"); err("Anti-Cheater: You cannot use this agent");
@@ -59,7 +59,7 @@ function benc_resp_raw($x) {
header("Content-Type: text/plain; charset=utf-8"); header("Content-Type: text/plain; charset=utf-8");
header("Pragma: no-cache"); header("Pragma: no-cache");
if ($_SERVER["HTTP_ACCEPT_ENCODING"] == "gzip" && function_exists('gzencode')) { if (isset($_SERVER["HTTP_ACCEPT_ENCODING"]) && $_SERVER["HTTP_ACCEPT_ENCODING"] == "gzip" && function_exists('gzencode')) {
header("Content-Encoding: gzip"); header("Content-Encoding: gzip");
echo gzencode($x, 9, FORCE_GZIP); echo gzencode($x, 9, FORCE_GZIP);
} }
+3 -3
View File
@@ -393,10 +393,10 @@ $lang_settings = array
'text_show_classic_note' => "Default 'no'. Show classic resources on main page. Only designated moderators or above can pick classic resources.", 'text_show_classic_note' => "Default 'no'. Show classic resources on main page. Only designated moderators or above can pick classic resources.",
'row_enable_imdb_system' => "Enable IMDb system", 'row_enable_imdb_system' => "Enable IMDb system",
'text_imdb_system_note' => "Default 'yes'. System-wide IMDb info setting.", 'text_imdb_system_note' => "Default 'yes'. System-wide IMDb info setting.",
'text_enable_pt_gen_system_note' => 'Enable PT-Gen system', 'row_enable_pt_gen_system' => 'Enable PT-Gen system',
'text_enable_pt_gen_note' => "Default 'yes'. System-wide PT-Gen info setting.", 'text_enable_pt_gen_system_note' => "Default 'yes'. System-wide PT-Gen info setting.",
'row_pt_gen_api_point' => "PT-Gen api point", 'row_pt_gen_api_point' => "PT-Gen api point",
'text_pt_gen_api_point_note' => "Default 'https://ptgen.rhilip.info', when broken, reference to<b><a href=\"https://github.com/Rhilip/pt-gen-cfworker\">Documatation</a></b>uild yourself", 'text_pt_gen_api_point_note' => "Default 'https://ptgen.rhilip.info', when broken, reference to <b><a href=\"https://github.com/Rhilip/pt-gen-cfworker\">Documatation</a></b> to build yourself",
'row_enable_school_system' => "Enable school system", 'row_enable_school_system' => "Enable school system",
'text_school_system_note' => "Default 'no'. <font class=striking><b>DO NOT</b></font> enable this unless you know what you are doing!", 'text_school_system_note' => "Default 'no'. <font class=striking><b>DO NOT</b></font> enable this unless you know what you are doing!",
'row_restrict_email_domain' => "Restrict Email Domain", 'row_restrict_email_domain' => "Restrict Email Domain",
+1 -1
View File
@@ -1,6 +1,6 @@
<?php <?php
require_once('../include/bittorrent_announce.php'); require_once('../include/bittorrent_announce.php');
require_once('include/benc.php'); require_once('../include/benc.php');
dbconn_announce(); dbconn_announce();
//1. BLOCK ACCESS WITH WEB BROWSERS AND CHEATS! //1. BLOCK ACCESS WITH WEB BROWSERS AND CHEATS!
$agent = $_SERVER["HTTP_USER_AGENT"]; $agent = $_SERVER["HTTP_USER_AGENT"];
+1
View File
@@ -67,6 +67,7 @@ if ($Attach->enable_attachment())
$filemd5 = md5_file($file['tmp_name']); $filemd5 = md5_file($file['tmp_name']);
$filename = date("YmdHis").$filemd5; $filename = date("YmdHis").$filemd5;
$file_location = make_folder($savedirectory_attachment."/", $savepath) . $filename; $file_location = make_folder($savedirectory_attachment."/", $savepath) . $filename;
do_log("file_location: $file_location");
$db_file_location = $savepath.$filename; $db_file_location = $savepath.$filename;
$abandonorig = false; $abandonorig = false;
$hasthumb = false; $hasthumb = false;
+1 -1
View File
@@ -72,7 +72,7 @@ else{
$res = sql_query("SELECT name, filename, save_as, size, owner,banned FROM torrents WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__); $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); $row = mysql_fetch_assoc($res);
$fn = "$torrent_dir/$id.torrent"; $fn = ROOT_PATH . "$torrent_dir/$id.torrent";
if ($CURUSER['downloadpos']=="no") if ($CURUSER['downloadpos']=="no")
permissiondenied(); permissiondenied();
if (!$row || !is_file($fn) || !is_readable($fn)) if (!$row || !is_file($fn) || !is_readable($fn))
+1 -1
View File
@@ -39,7 +39,7 @@ print("<div align=\"right\">".$lang_login['text_select_lang']. $s . "</div>");
unset($returnto); unset($returnto);
if (!empty($_GET["returnto"])) { if (!empty($_GET["returnto"])) {
$returnto = $_GET["returnto"]; $returnto = $_GET["returnto"];
if (!$_GET["nowarn"]) { if (empty($_GET["nowarn"])) {
print("<h1>" . $lang_login['h1_not_logged_in']. "</h1>\n"); 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"); print("<p><b>" . $lang_login['p_error']. "</b> " . $lang_login['p_after_logged_in']. "</p>\n");
} }
+2 -6
View File
@@ -8,10 +8,6 @@ parked();
if (get_user_class() < UC_SYSOP) if (get_user_class() < UC_SYSOP)
permissiondenied(); permissiondenied();
//read all configuration files
require('config/allconfig.php');
function go_back() function go_back()
{ {
global $lang_settings; global $lang_settings;
@@ -372,9 +368,9 @@ elseif ($action == 'authoritysettings') //Authority settings
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_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_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); 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") // 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); 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") // 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_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_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_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);
+2 -1
View File
@@ -117,8 +117,9 @@ else
while ($arr = mysql_fetch_assoc($res)) while ($arr = mysql_fetch_assoc($res))
{ {
$del = '';
if (get_user_class() >= $sbmanage_class) { if (get_user_class() >= $sbmanage_class) {
$del="[<a href=\"shoutbox.php?del=".$arr['id']."\">".$lang_shoutbox['text_del']."</a>]"; $del .= "[<a href=\"shoutbox.php?del=".$arr['id']."\">".$lang_shoutbox['text_del']."</a>]";
} }
if ($arr["userid"]) { if ($arr["userid"]) {
$username = get_username($arr["userid"],false,true,true,true,false,false,"",true); $username = get_username($arr["userid"],false,true,true,true,false,false,"",true);
+4 -4
View File
@@ -30,7 +30,7 @@ if ($row["passhash"] != md5($row["secret"] . $password . $row["secret"]))
if ($row["enabled"] == "no") if ($row["enabled"] == "no")
bark($lang_takelogin['std_account_disabled']); bark($lang_takelogin['std_account_disabled']);
if ($_POST["securelogin"] == "yes") if (isset($_POST["securelogin"]) && $_POST["securelogin"] == "yes")
{ {
$securelogin_indentity_cookie = true; $securelogin_indentity_cookie = true;
$passh = md5($row["passhash"].$_SERVER["REMOTE_ADDR"]); $passh = md5($row["passhash"].$_SERVER["REMOTE_ADDR"]);
@@ -41,7 +41,7 @@ else
$passh = md5($row["passhash"]); $passh = md5($row["passhash"]);
} }
if ($securelogin=='yes' || $_POST["ssl"] == "yes") if ($securelogin=='yes' || (isset($_POST["ssl"]) && $_POST["ssl"] == "yes"))
{ {
$pprefix = "https://"; $pprefix = "https://";
$ssl = true; $ssl = true;
@@ -51,7 +51,7 @@ else
$pprefix = "http://"; $pprefix = "http://";
$ssl = false; $ssl = false;
} }
if ($securetracker=='yes' || $_POST["trackerssl"] == "yes") if ($securetracker=='yes' || (isset($_POST["trackerssl"] ) && $_POST["trackerssl"] == "yes"))
{ {
$trackerssl = true; $trackerssl = true;
} }
@@ -59,7 +59,7 @@ else
{ {
$trackerssl = false; $trackerssl = false;
} }
if ($_POST["logout"] == "yes") if (isset($_POST["logout"]) && $_POST["logout"] == "yes")
{ {
logincookie($row["id"], $passh,1,900,$securelogin_indentity_cookie, $ssl, $trackerssl); logincookie($row["id"], $passh,1,900,$securelogin_indentity_cookie, $ssl, $trackerssl);
//sessioncookie($row["id"], $passh,true); //sessioncookie($row["id"], $passh,true);
+1 -1
View File
@@ -1,5 +1,5 @@
<?php <?php
require_once("include/benc.php"); require_once("../include/benc.php");
require_once("../include/bittorrent.php"); require_once("../include/bittorrent.php");
ini_set("upload_max_filesize",$max_torrent_size); ini_set("upload_max_filesize",$max_torrent_size);
+3 -2
View File
@@ -34,6 +34,7 @@ function dltable($name, $arr, $torrent)
"<td class=colhead align=center width=1%>".$lang_viewpeerlist['col_idle']."</td>" . "<td class=colhead align=center width=1%>".$lang_viewpeerlist['col_idle']."</td>" .
"<td class=colhead align=center width=1%>".$lang_viewpeerlist['col_client']."</td></tr>\n"; "<td class=colhead align=center width=1%>".$lang_viewpeerlist['col_client']."</td></tr>\n";
$now = time(); $now = time();
$num = 0;
foreach ($arr as $e) { foreach ($arr as $e) {
$privacy = get_single_value("users", "privacy","WHERE id=".sqlesc($e['userid'])); $privacy = get_single_value("users", "privacy","WHERE id=".sqlesc($e['userid']));
++$num; ++$num;
@@ -62,7 +63,7 @@ function dltable($name, $arr, $torrent)
} }
else $location = ""; else $location = "";
$s .= "<td class=rowfollow align=center width=1%><nobr>" . ($e[connectable] == "yes" ? $lang_viewpeerlist['text_yes'] : "<font color=red>".$lang_viewpeerlist['text_no']."</font>") . "</nobr></td>\n"; $s .= "<td class=rowfollow align=center width=1%><nobr>" . ($e['connectable'] == "yes" ? $lang_viewpeerlist['text_yes'] : "<font color=red>".$lang_viewpeerlist['text_no']."</font>") . "</nobr></td>\n";
$s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize($e["uploaded"]) . "</nobr></td>\n"; $s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize($e["uploaded"]) . "</nobr></td>\n";
$s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize(($e["uploaded"] - $e["uploadoffset"]) / $secs) . "/s</nobr></td>\n"; $s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize(($e["uploaded"] - $e["uploadoffset"]) / $secs) . "/s</nobr></td>\n";
@@ -71,7 +72,7 @@ function dltable($name, $arr, $torrent)
if ($e["seeder"] == "no") if ($e["seeder"] == "no")
$s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize(($e["downloaded"] - $e["downloadoffset"]) / $secs) . "/s</nobr></td>\n"; $s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize(($e["downloaded"] - $e["downloadoffset"]) / $secs) . "/s</nobr></td>\n";
else else
$s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize(($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e[st])) . "/s</nobr></td>\n"; $s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize(($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e['st'])) . "/s</nobr></td>\n";
if ($e["downloaded"]) if ($e["downloaded"])
{ {
$ratio = floor(($e["uploaded"] / $e["downloaded"]) * 1000) / 1000; $ratio = floor(($e["uploaded"] / $e["downloaded"]) * 1000) / 1000;