/** * @param Page $page * @param array $history * @param int $page_number */ public function display_global_page(Page $page, $history, $page_number) { $start_string = "\n\t\t\t<div style='text-align: left'>\n\t\t\t\t" . make_form(make_link("tag_history/revert")) . "\n\t\t\t\t\t<ul style='list-style-type:none;'>\n\t\t"; $end_string = "\n\t\t\t\t\t</ul>\n\t\t\t\t\t<input type='submit' value='Revert To'>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t"; global $user; $history_list = ""; foreach ($history as $fields) { $current_id = $fields['id']; $image_id = $fields['image_id']; $current_tags = html_escape($fields['tags']); $name = $fields['name']; $h_ip = $user->can("view_ip") ? " " . show_ip($fields['user_ip'], "Tagging Image #{$image_id} as '{$current_tags}'") : ""; $setter = "<a href='" . make_link("user/" . url_escape($name)) . "'>" . html_escape($name) . "</a>{$h_ip}"; $history_list .= ' <li> <input type="radio" name="revert" value="' . $current_id . '"> <a href="' . make_link('post/view/' . $image_id) . '">' . $image_id . '</a>: ' . $current_tags . ' (Set by ' . $setter . ') </li> '; } $history_html = $start_string . $history_list . $end_string; $page->set_title("Global Tag History"); $page->set_heading("Global Tag History"); $page->add_block(new Block("Tag History", $history_html, "main", 10)); $h_prev = $page_number <= 1 ? "Prev" : '<a href="' . make_link('tag_history/all/' . ($page_number - 1)) . '">Prev</a>'; $h_index = "<a href='" . make_link() . "'>Index</a>"; $h_next = '<a href="' . make_link('tag_history/all/' . ($page_number + 1)) . '">Next</a>'; $nav = $h_prev . ' | ' . $h_index . ' | ' . $h_next; $page->add_block(new Block("Navigation", $nav, "left")); }
public function get_user_editor_html(Image $image) { global $user; $h_owner = html_escape($image->get_owner()->name); $h_av = $image->get_owner()->get_avatar_html(); $h_date = autodate($image->posted); $h_ip = $user->can("view_ip") ? " (" . show_ip($image->owner_ip, "Image posted {$image->posted}") . ")" : ""; return "\n\t\t\t<tr>\n\t\t\t\t<th>Uploader</th>\n\t\t\t\t<td>\n\t\t" . ($user->can("edit_image_owner") ? "\n\t\t\t\t\t<span class='view'><a class='username' href='" . make_link("user/{$h_owner}") . "'>{$h_owner}</a>{$h_ip}, {$h_date}</span>\n\t\t\t\t\t<input class='edit' type='text' name='tag_edit__owner' value='{$h_owner}'>\n\t\t" : "\n\t\t\t\t\t<a class='username' href='" . make_link("user/{$h_owner}") . "'>{$h_owner}</a>{$h_ip}, {$h_date}\n\t\t") . "\n\t\t\t\t</td>\n\t\t\t\t<td width='80px' rowspan='4'>{$h_av}</td>\n\t\t\t</tr>\n\t\t"; }
/** * Generates the html for display. * @param int $id * @param string $domain * @param int $port * @param int $time * @param int $code * @return string */ function gen_html($id, $domain, $port, $time, $code) { $units = gen_units($time); if ($time < 1) { $time = $time * 1000; } else { $time = round($time, 2); } if ($time <= 0) { $time = "< 1"; } if ($id == 1) { $html = "<p><a href=\"http://" . gen_domain($domain, $port) . "\" class=\"domain\" title=\"" . $domain . "\" rel=\"nofollow\">" . $domain . "</a> is working <span class=\"smile\">:)</span></p>\n\n"; $html .= "\t<p class=\"smaller\">It took " . $time . " " . $units . " for a <a href=\"http://en.wikipedia.org/wiki/List_of_HTTP_status_codes\" title=\"Wikipedia - HTTP Status Codes\">" . $code . "</a> response" . show_ip($domain) . ".</p>\n\n"; $html .= "\t<p class=\"smaller\">Check <a href=\"/\" title=\"Home\">another site</a>" . gen_save($domain) . ".</p>\n"; } else { if ($id == 2) { if (!empty($code) && is_numeric($code)) { $text = "We got a <a href=\"http://en.wikipedia.org/wiki/List_of_HTTP_status_codes\" title=\"Wikipedia - HTTP Status Codes\">" . $code . "</a> http status code" . show_ip($domain) . "."; } $html = "<p><a href=\"http://" . gen_domain($domain, $port) . "\" class=\"domain\" title=\"" . $domain . "\" rel=\"nofollow\">" . $domain . "</a> seems to be down <span class=\"smile\">:(</span></p>\n\n"; if (isset($text)) { $html .= "\t<p class=\"smaller\">" . $text . "</p>\n"; } $html .= "\t<p class=\"smaller\">Check <a href=\"/\" title=\"Home\">another site</a>" . gen_save($domain) . ".</p>\n"; } else { if ($id == 0) { $html = "<p>We need a valid domain to check! <a href=\"/d/" . gen_domain($domain, $port) . "\">Try again.</a></p>\n"; } } } if ($domain == "isitup.org" || $domain == "127.0.0.1") { $html = "<p>Have a think about what you've just done. <a href=\"/\" title=\"Better luck next time.\">Try again.</a></p>\n"; } return $html; }
/** * @param \Comment $comment * @param bool $trim * @return string */ protected function comment_to_html(Comment $comment, $trim = false) { global $config, $user; $tfe = new TextFormattingEvent($comment->comment); send_event($tfe); $i_uid = int_escape($comment->owner_id); $h_name = html_escape($comment->owner_name); $h_poster_ip = html_escape($comment->poster_ip); $h_timestamp = autodate($comment->posted); $h_comment = $trim ? truncate($tfe->stripped, 50) : $tfe->formatted; $i_comment_id = int_escape($comment->comment_id); $i_image_id = int_escape($comment->image_id); if ($i_uid == $config->get_int("anon_id")) { $anoncode = ""; $anoncode2 = ""; if ($this->show_anon_id) { $anoncode = '<sup>' . $this->anon_id . '</sup>'; if (!array_key_exists($comment->poster_ip, $this->anon_map)) { $this->anon_map[$comment->poster_ip] = $this->anon_id; } #if($user->can("view_ip")) { #$style = " style='color: ".$this->get_anon_colour($comment->poster_ip).";'"; if ($user->can("view_ip") || $config->get_bool("comment_samefags_public", false)) { if ($this->anon_map[$comment->poster_ip] != $this->anon_id) { $anoncode2 = '<sup>(' . $this->anon_map[$comment->poster_ip] . ')</sup>'; } } } $h_userlink = "<span class='username'>" . $h_name . $anoncode . $anoncode2 . "</span>"; $this->anon_id++; } else { $h_userlink = '<a class="username" href="' . make_link('user/' . $h_name) . '">' . $h_name . '</a>'; } $stripped_nonl = str_replace("\n", "\\n", substr($tfe->stripped, 0, 50)); $stripped_nonl = str_replace("\r", "\\r", $stripped_nonl); $hb = $comment->owner_class == "hellbanned" ? "hb" : ""; if ($trim) { $html = "\n\t\t\t<div class=\"comment {$hb}\">\n\t\t\t\t{$h_userlink}: {$h_comment}\n\t\t\t\t<a href=\"" . make_link("post/view/{$i_image_id}#c{$i_comment_id}") . "\">>>></a>\n\t\t\t</div>\n\t\t\t"; } else { $h_avatar = ""; if (!empty($comment->owner_email)) { $hash = md5(strtolower($comment->owner_email)); $cb = date("Y-m-d"); $h_avatar = "<img src=\"http://www.gravatar.com/avatar/{$hash}.jpg?cacheBreak={$cb}\"><br>"; } $h_reply = " - <a href='javascript: replyTo({$i_image_id}, {$i_comment_id}, \"{$h_name}\")'>Reply</a>"; $h_ip = $user->can("view_ip") ? "<br>" . show_ip($comment->poster_ip, "Comment posted {$comment->posted}") : ""; $h_del = $user->can("delete_comment") ? ' - <a onclick="return confirm(\'Delete comment by ' . $h_name . ':\\n' . $stripped_nonl . '\');" ' . 'href="' . make_link('comment/delete/' . $i_comment_id . '/' . $i_image_id) . '">Del</a>' : ''; $html = "\n\t\t\t\t<div class=\"comment {$hb}\" id=\"c{$i_comment_id}\">\n\t\t\t\t\t<div class=\"info\">\n\t\t\t\t\t{$h_avatar}\n\t\t\t\t\t{$h_timestamp}{$h_reply}{$h_ip}{$h_del}\n\t\t\t\t\t</div>\n\t\t\t\t\t{$h_userlink}: {$h_comment}\n\t\t\t\t</div>\n\t\t\t"; } return $html; }
$err = 1; } if ($_POST["check"] != uncrypt2($_POST["asd1"], $_POST["asd2"])) { $att = "Неверный код."; $err = 1; } if ($err != 1) { $row = sqla("SELECT * FROM `users` WHERE `smuser`='" . strtolower($_POST['user']) . "' or `email`='" . strtolower($_POST['email']) . "'"); if ($row["user"] != "") { $att = "Такой персонаж или e-mail уже существует."; $err = 1; } $exp = 0; if (@$_COOKIE["referalUID"] && $err != 1) { $p = sqla("SELECT uid,user,lastip FROM users WHERE uid=" . intval($_COOKIE["referalUID"]) . ""); if (!show_ip() or show_ip() == $p["lastip"]) { $att = "У вас \"нехороший\" IP. (Либо HideIP, либо ваш IP совпадает с персонажем, который привёл вас в игру)"; $err = 1; } else { $exp = 100; } } if ($err != 1) { $ds = date("d.m.Y H:i"); $uid = sqla("SELECT MAX(uid) FROM `users`"); $uid = $uid[0] + 1; sql("INSERT INTO `chars` (`uid`) VALUES (" . $uid . "); "); $res = sql("INSERT INTO `users` ( `user` , `pass` , `city` , `country` , `name` , `dr` , `uid` , `level` , `email` ,`ds` , `pol`,`location`,`smuser`,wears,`zeroing`,`referal_nick`,`referal_uid`,`money`,x,y,`exp`)\n VALUES ('" . $_POST['user'] . "', '" . md5($_POST['pass']) . "', '" . $_POST['city'] . "', '" . $_POST['country'] . "', '" . $_POST['name'] . "', '" . $_POST['dayd'] . "." . $_POST['monthd'] . "." . $_POST['yeard'] . "', '" . $uid . "', '0', '" . strtolower($_POST['email']) . "' , '" . $ds . "' ,'" . $_POST["pol"] . "','arena',LOWER('" . $_POST['user'] . "'),'none|none|none|none|none|none|none|none|none|none|none|none|none|none|none|none|none|none|',1,'" . $p["user"] . "','" . $p["uid"] . "',1,0,0," . $exp . "); "); if (!mysql_error()) { $att = ";top.Enter('" . $uid . "','" . md5($_POST['pass']) . "');"; setcookie("hh_reg", 1, tme() + 21600);
/** * Generates the html for display. * * @param int $id * @param string $domain * @param int $port * @param int $time * @param int $code * * @return string */ function gen_html($id, $domain, $port, $time, $code) { $units = gen_units($time); if ($time < 1) { $time = $time * 1000; } else { $time = round($time, 2); } if ($time <= 0) { $time = "< 1"; } if ($id == 1) { $html = "<p><a href=\"http://" . gen_domain($domain, $port) . "\" class=\"domain\" title=\"http://" . $domain . "/\" rel=\"nofollow\">" . $domain . "</a> is up.</p>\n\n"; $html .= "\t<p class=\"smaller\">It took " . $time . " " . $units . " for a " . gen_http_wiki_link($code) . " response code" . show_ip($domain) . ".</p>\n\n"; $html .= "\t<p class=\"smaller\"><a href=\"/\" title=\"Home\">Go back</a> to check another site" . gen_save($domain) . ".</p>\n"; } else { if ($id == 2) { if (!empty($code) && is_numeric($code)) { $text = "We got a " . gen_http_wiki_link($code) . " response code" . show_ip($domain) . "."; } $html = "<p><a href=\"http://" . gen_domain($domain, $port) . "\" class=\"domain\" title=\"http://" . $domain . "/\" rel=\"nofollow\">" . $domain . "</a> seems to be down!</p>\n\n"; if (isset($text)) { $html .= "\t<p class=\"smaller\">" . $text . "</p>\n"; } $html .= "\t<p class=\"smaller\"><a href=\"/\" title=\"Home\">Go back</a> to check another site" . gen_save($domain) . ".</p>\n"; } else { if ($id == 3) { $html = "<p>We need a valid domain to check! <a href=\"/d/" . gen_domain($domain, $port) . "\">Try again.</a></p>\n"; } } } if ($domain == "isitup.org" || $domain == "127.0.0.1") { $html = "<p>Have a think about what you've just done and <a href=\"/\" title=\"Better luck next time.\">try again.</a></p>\n"; } return $html; }
<?php if (!isset($GLOBALS['Jlib_page'])) { include 'JsHttpRequest.php'; $JsHttpRequest = new JsHttpRequest("windows-1251"); if (empty($_REQUEST['uip'])) { $_REQUEST['uip'] = !empty($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : (!empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null)); } $uip = $_REQUEST['uip']; } else { $uip = show_ip(); } $source_domain = 'freegeoip.net'; $link = '/xml/' . $_REQUEST['uip']; $fp = fsockopen($source_domain, 80, $errno, $errstr, 30); if (!$fp) { echo "{$errstr} ({$errno})<br />\n"; } else { $out = "GET {$link} HTTP/1.1\r\n"; $out .= "Host: {$source_domain}\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); $i = 0; $start = false; $sqler = 500; $sqlcnt = $sqler; $content = ''; while (!feof($fp)) { $dn = fgets($fp); if (!$start) { //echo 'Заголовок: '.$dn.'<br>';
function show_geo() { if (!empty($_GET['lat']) && !empty($_GET['lng'])) { $_SESSION['geolocation'] = array('lat' => $_GET['lat'], 'lng' => $_GET['lng']); } if (!empty($_SESSION['geolocation'])) { return $_SESSION['geolocation']['lat'] . ',' . $_SESSION['geolocation']['lng']; } else { //Обращение к сервису $ip = show_ip(); $json = get_page('freegeoip.net', '/json/' . $ip); if (empty($json)) { return ''; } $dt = json_decode($json); if (empty($dt)) { return ''; } $_SESSION['geolocation']['lat'] = $dt->latitude; $_SESSION['geolocation']['lng'] = $dt->longitude; $_SESSION['geolocation']['city'] = strtolower($dt->city); $_SESSION['geolocation']['reg'] = strtolower($dt->region_name); /* $rega='~<Latitude>([^<]+)</Latitude>\s+<Longitude>([^<]+)</Longitude>~'; preg_match_all($rega, $content, $m); if( !empty($m) && !empty($m[1][0]) && !empty($m[1][0])){ $_SESSION['geolocation']['lat']=$m[1][0]; $_SESSION['geolocation']['lng']=$m[2][0]; return $m[1][0].','.$m[2][0]; }else{ return 'false'; } */ } }