} else if ((isset ($_GET ["do"])) and ($_GET ["do"] === "hublist")) { // do=hublist
$html = str_replace ("[class_news]", "menu", $html);
$html = str_replace ("[class_work]", "menu", $html);
$html = str_replace ("[class_network]", "menu", $html);
$html = str_replace ("[class_forum]", "menu", $html);
$html = str_replace ("[class_gallery]", "menu", $html);
$html = str_replace ("[class_hublist]", "menu active", $html);
$html = str_replace ("[class_tools]", "menu", $html);
$html = str_replace ("[class_stats]", "menu", $html);
$html = str_replace ("[class_about]", "menu", $html);
$html = str_replace ("[class_login]", "menu", $html);
$html = str_replace ("[class_client]", "menu", $html);
$html = str_replace ("[class_clientdc]", "menu", $html);
$html = str_replace ("[class_Lists]", "menu", $html);
if ($nosc) { // dont count visitors for plain text pages
$html = str_replace ("[visit_page]", 0, $html);
$html = str_replace ("[visit_country]", 0, $html);
} else {
$visit = visitcount ("hublist");
$html = str_replace ("[visit_page]", $visit ["page"], $html);
$html = str_replace ("[visit_country]", $visit ["country"], $html);
}
$echo = true;
if ((isset ($_GET ["id"])) and ($_GET ["id"] !== "")) { // specific id
if (($sql = $mysql->query ("select * from `hublist` where `id` = " . intval ($_GET ["id"]) . " OR `rediraddr` = '" . $mysql->escape_string ($_GET ["id"]) . "'" )) and ($sql->num_rows > 0) and ($row = $sql->fetch_array ())) {
if ((isset ($_GET ["action"])) and ($_GET ["action"] === "comment")) { // action=comment
$html = str_replace ("%title%", "HublistDc++ хабов Huburi" . safetext ((($row ["name"]) and ($row ["name"] !== "")) ? $row ["name"] : $row ["address"] . ((intval ($row ["port"]) !== 411) ? ":" . $row ["port"] : "")) . " - Comment", $html);
$html = str_replace ("%id%", "hublist" . safetext ((($row ["id"]) and ($row ["id"] !== "")) ? $row ["id"] : $row ["address"] . ((intval ($row ["port"]) !== 411) ? ":" . $row ["port"] : "")) . "&action=comment", $html);
$content = "";
$err_author = false;
$err_text = false;
$err_vote = false;
$err_code = false;
$err_string = "";
if (isset ($_POST ["comment_send"])) {
if ((isset ($_POST ["comment_author"])) and ($_POST ["comment_author"] !== "") and ($authorized === 0) and ($sql = $mysql->query ("select `class` from `accounts` where `username` = '" . $mysql->escape_string ($_POST ["comment_author"]) . "'")) and ($sql->num_rows > 0)) {
$err_author = true;
$err_string = "Author value is reserved, please use something else.";
} else if ((!isset ($_POST ["comment_text"])) or ($_POST ["comment_text"] === "")) {
$err_text = true;
$err_string = "Comment field is required.";
} else if ((isset ($_POST ["comment_vote"])) and ($_POST ["comment_vote"] !== "") and ($_POST ["comment_vote"] !== "good") and ($_POST ["comment_vote"] !== "bad")) {
$err_vote = true;
$err_string = "Vote field value is invalid.";
} else if (($authorized === 0) and ((!isset ($_POST ["comment_code"])) or ($_POST ["comment_code"] === ""))) {
$err_code = true;
$err_string = "Code field is required.";
} else if (($authorized === 0) and (!captcharesult ($_POST ["comment_codea"], $_POST ["comment_codeb"], $_POST ["comment_codec"], $_POST ["comment_code"]))) { // ($_POST ["comment_code"] !== (((isset ($_SESSION ["key"])) and ($_SESSION ["key"] !== "")) ? $_SESSION ["key"] : "123456"))
$err_code = true;
$err_string = "Invalid security code.";
} else if ((isset ($_POST ["comment_vote"])) and ($_POST ["comment_vote"] !== "") and ($istor)) {
$err_vote = true;
$err_string = "You can't vote for this hub because you're using Tor.";
} else if ((isset ($_POST ["comment_vote"])) and ($_POST ["comment_vote"] !== "") and (intval ($row ["banned"]) === 1)) {
$err_vote = true;
$err_string = "You can't vote for this hub because it's banned.";
} else {
$ok = true;
if ((isset ($_POST ["comment_vote"])) and ($_POST ["comment_vote"] !== "")) { // submit vote if we have one
if (($sql = $mysql->query ("select `id`, `time` from `hubvotes` where `addr` = '" . $mysql->escape_string ($_SERVER ["REMOTE_ADDR"]) . "' and `hub` = " . $row ["id"] . " limit 1")) and ($sql->num_rows > 0) and ($vote = $sql->fetch_array ())) {
if (($diff = (time () - $vote ["time"])) < 86400) {
$err_vote = true;
$err_string = sprintf ("You can't vote for this hub more than once a day, wait another %s.", uptimefromsec (86400 - $diff));
$ok = false;
} else {
$mysql->query ("update `hubvotes` set `vote` = '" . (($_POST ["comment_vote"] === "good") ? "+" : "-") . "', `time` = " . time () . ", `notify` = 0 where `id` = " . $vote ["id"]);
}
} else {
$mysql->query ("insert into `hubvotes` (`vote`, `time`, `addr`, `hub`) values ('" . (($_POST ["comment_vote"] === "good") ? "+" : "-") . "', " . time () . ", '" . $mysql->escape_string ($_SERVER ["REMOTE_ADDR"]) . "', " . $row ["id"] . ")");
}
if ($ok) {
$mysql->query ("update `hublist` set `" . $_POST ["comment_vote"] . "vote` = `" . $_POST ["comment_vote"] . "vote` + 1 where `id` = " . $row ["id"]);
}
}
if ($ok) {
$mysql->query ("insert into `comments` (`author`, `text`, `time`, `ip`, `type`, `type_id`) values (" . (((isset ($_POST ["comment_author"])) and ($_POST ["comment_author"] !== "")) ? "'" . $mysql->escape_string ($_POST ["comment_author"]) . "'" : "null") . ", '" . $mysql->escape_string ($_POST ["comment_text"]) . "', " . time () . ", '" . $mysql->escape_string ($_SERVER ["REMOTE_ADDR"]) . "', 5, " . $row ["id"] . ")");
header ("Location: https://andress/?do=hublist&id=" . $row ["id"] . "#" . $mysql->insert_id);
$echo = false;