diff --git a/include/bittorrent.php b/include/bittorrent.php index b4e18554..eac58645 100644 --- a/include/bittorrent.php +++ b/include/bittorrent.php @@ -12,7 +12,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . $rootpath); $rootpath .= "/"; require $rootpath . 'include/functions.php'; require $rootpath . 'include/globalfunctions.php'; -require $rootpath . get_langfile_path("functions.php"); require $rootpath . 'include/core.php'; diff --git a/include/config.php b/include/config.php index eb1f06a0..6f230af4 100644 --- a/include/config.php +++ b/include/config.php @@ -62,7 +62,7 @@ if (file_exists('config/allconfig.php')) { */ //load settings from database -if (basename($_SERVER['SCRIPT_FILENAME']) == 'announce.php') { +if (IS_ANNOUNCE) { dbconn_announce(); } else { dbconn(); @@ -408,4 +408,3 @@ $useCronTriggerCleanUp = $MAIN['use_cron_trigger_cleanup']; //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(); -?> diff --git a/include/core.php b/include/core.php index b85c05b5..c1fa72ab 100644 --- a/include/core.php +++ b/include/core.php @@ -9,6 +9,7 @@ if (!empty($_SERVER['HTTP_X_REQUEST_ID'])) { define('REQUEST_ID', intval(NEXUS_START * 10000)); } define('ROOT_PATH', $rootpath); +define('IS_ANNOUNCE', (basename($_SERVER['SCRIPT_FILENAME']) == 'announce.php')); require $rootpath . 'include/database/interface_db.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_cache_redis.php'; require $rootpath . 'include/config.php'; +if (!IS_ANNOUNCE) { + require $rootpath . get_langfile_path("functions.php"); +} ini_set('display_errors', $TWEAK['display_errors']); diff --git a/include/functions.php b/include/functions.php index d7210a8c..c7239184 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2703,7 +2703,9 @@ function get_langid_from_langcookie() function make_folder($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); return $path; } diff --git a/include/functions_announce.php b/include/functions_announce.php index 644d2f80..ee9abb47 100644 --- a/include/functions_announce.php +++ b/include/functions_announce.php @@ -42,7 +42,7 @@ function block_browser() //else // $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"])) 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("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"); echo gzencode($x, 9, FORCE_GZIP); } diff --git a/lang/en/lang_settings.php b/lang/en/lang_settings.php index 39b13330..60b587f3 100644 --- a/lang/en/lang_settings.php +++ b/lang/en/lang_settings.php @@ -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.", 'row_enable_imdb_system' => "Enable IMDb system", 'text_imdb_system_note' => "Default 'yes'. System-wide IMDb info setting.", - 'text_enable_pt_gen_system_note' => 'Enable PT-Gen system', - 'text_enable_pt_gen_note' => "Default 'yes'. System-wide PT-Gen info setting.", + 'row_enable_pt_gen_system' => 'Enable PT-Gen system', + 'text_enable_pt_gen_system_note' => "Default 'yes'. System-wide PT-Gen info setting.", 'row_pt_gen_api_point' => "PT-Gen api point", - 'text_pt_gen_api_point_note' => "Default 'https://ptgen.rhilip.info', when broken, reference toDocumatationuild yourself", + 'text_pt_gen_api_point_note' => "Default 'https://ptgen.rhilip.info', when broken, reference to Documatation to build yourself", 'row_enable_school_system' => "Enable school system", 'text_school_system_note' => "Default 'no'. DO NOT enable this unless you know what you are doing!", 'row_restrict_email_domain' => "Restrict Email Domain", diff --git a/public/announce.php b/public/announce.php index 8fb6c48f..00ff2281 100644 --- a/public/announce.php +++ b/public/announce.php @@ -1,6 +1,6 @@ enable_attachment()) $filemd5 = md5_file($file['tmp_name']); $filename = date("YmdHis").$filemd5; $file_location = make_folder($savedirectory_attachment."/", $savepath) . $filename; + do_log("file_location: $file_location"); $db_file_location = $savepath.$filename; $abandonorig = false; $hasthumb = false; diff --git a/public/download.php b/public/download.php index c7de6867..c747d645 100644 --- a/public/download.php +++ b/public/download.php @@ -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__); $row = mysql_fetch_assoc($res); -$fn = "$torrent_dir/$id.torrent"; +$fn = ROOT_PATH . "$torrent_dir/$id.torrent"; if ($CURUSER['downloadpos']=="no") permissiondenied(); if (!$row || !is_file($fn) || !is_readable($fn)) diff --git a/public/login.php b/public/login.php index cb31d5e6..b05f2326 100644 --- a/public/login.php +++ b/public/login.php @@ -39,7 +39,7 @@ print("
" . $lang_login['p_error']. " " . $lang_login['p_after_logged_in']. "
\n"); } diff --git a/public/settings.php b/public/settings.php index 18e6cffe..9044ba84 100644 --- a/public/settings.php +++ b/public/settings.php @@ -8,10 +8,6 @@ parked(); if (get_user_class() < UC_SYSOP) permissiondenied(); -//read all configuration files -require('config/allconfig.php'); - - function go_back() { 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_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") +// 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") +// 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); diff --git a/public/shoutbox.php b/public/shoutbox.php index 8516274d..efebdbb7 100644 --- a/public/shoutbox.php +++ b/public/shoutbox.php @@ -117,8 +117,9 @@ else while ($arr = mysql_fetch_assoc($res)) { + $del = ''; if (get_user_class() >= $sbmanage_class) { - $del="[".$lang_shoutbox['text_del']."]"; + $del .= "[".$lang_shoutbox['text_del']."]"; } if ($arr["userid"]) { $username = get_username($arr["userid"],false,true,true,true,false,false,"",true); diff --git a/public/takelogin.php b/public/takelogin.php index d5ceb6c4..617447cc 100644 --- a/public/takelogin.php +++ b/public/takelogin.php @@ -30,7 +30,7 @@ if ($row["passhash"] != md5($row["secret"] . $password . $row["secret"])) if ($row["enabled"] == "no") bark($lang_takelogin['std_account_disabled']); -if ($_POST["securelogin"] == "yes") +if (isset($_POST["securelogin"]) && $_POST["securelogin"] == "yes") { $securelogin_indentity_cookie = true; $passh = md5($row["passhash"].$_SERVER["REMOTE_ADDR"]); @@ -41,7 +41,7 @@ else $passh = md5($row["passhash"]); } -if ($securelogin=='yes' || $_POST["ssl"] == "yes") +if ($securelogin=='yes' || (isset($_POST["ssl"]) && $_POST["ssl"] == "yes")) { $pprefix = "https://"; $ssl = true; @@ -51,7 +51,7 @@ else $pprefix = "http://"; $ssl = false; } -if ($securetracker=='yes' || $_POST["trackerssl"] == "yes") +if ($securetracker=='yes' || (isset($_POST["trackerssl"] ) && $_POST["trackerssl"] == "yes")) { $trackerssl = true; } @@ -59,7 +59,7 @@ else { $trackerssl = false; } -if ($_POST["logout"] == "yes") +if (isset($_POST["logout"]) && $_POST["logout"] == "yes") { logincookie($row["id"], $passh,1,900,$securelogin_indentity_cookie, $ssl, $trackerssl); //sessioncookie($row["id"], $passh,true); diff --git a/public/takeupload.php b/public/takeupload.php index 2ba58cc6..8151b12b 100644 --- a/public/takeupload.php +++ b/public/takeupload.php @@ -1,5 +1,5 @@ ".$lang_viewpeerlist['col_idle']."" . "