mirror of
https://github.com/Xkeeper0/jul.git
synced 2025-05-19 00:30:21 -07:00
Fix and add thread meta tags
This commit is contained in:
parent
f50d45104c
commit
4fdd16cf57
@ -10,7 +10,7 @@
|
||||
header('Pragma: no-cache');
|
||||
|
||||
$userip = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
|
||||
if (!($clientip = filter_var(getenv("HTTP_CLIENT_IP"), FILTER_VALIDATE_IP))) $clientip = "XXXXXXXXXXXXXXXXX";
|
||||
if (!($forwardedip = filter_var(getenv("HTTP_X_FORWARDED_FOR"), FILTER_VALIDATE_IP))) $forwardedip = "XXXXXXXXXXXXXXXXX";
|
||||
// $clientip=(getenv("HTTP_CLIENT_IP") == "" ? "XXXXXXXXXXXXXXXXX" : getenv("HTTP_CLIENT_IP"));
|
||||
@ -285,17 +285,17 @@
|
||||
}
|
||||
|
||||
$views=$sql->resultq('SELECT views FROM misc')+1;
|
||||
|
||||
|
||||
if (!$ipbanned && !$torbanned && (!defined("IS_AJAX_REQUEST") || !IS_AJAX_REQUEST)) {
|
||||
// Don't increment the view counter for bots
|
||||
// Todo: Actually check for bots and disable it because hdurfs
|
||||
$sql->query("UPDATE misc SET views=$views");
|
||||
|
||||
|
||||
if($views%10000000>9999000 or $views%10000000<1000) {
|
||||
$u=($loguserid?$loguserid:0);
|
||||
$sql->query("INSERT INTO hits VALUES ($views,$u,'$userip',".ctime().')');
|
||||
}
|
||||
|
||||
|
||||
// Print out a message to IRC whenever a 10-million-view milestone is hit
|
||||
if ($views%10000000>9999994 || ($views % 10000000 >= 9991000 && $views % 1000 == 0) || ($views % 10000000 >= 9999900 && $views % 10 == 0) || ($views > 5 && $views % 10000000 < 5)) {
|
||||
xk_ircsend("0|View ". xk(11) . str_pad(number_format($views), 10, " ", STR_PAD_LEFT) . xk() ." by ". ($loguser['id'] ? xk(11) . str_pad($loguser['name'], 25, " ") : xk(12) . str_pad($_SERVER['REMOTE_ADDR'], 25, " ")) . xk() . ($views % 1000000 > 500000 ? " (". xk(12) . str_pad(number_format(1000000 - ($views % 1000000)), 5, " ", STR_PAD_LEFT) . xk(2) ." to go" . xk() .")" : ""));
|
||||
@ -359,7 +359,7 @@
|
||||
$yyy .= "<img src=images/wave/seaweed.png style=\"position: fixed; left: ". mt_rand(0,100) ."%; bottom: -". mt_rand(24,72) ."px;\" title=\"weed\">";
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
$dispviews = $views;
|
||||
// if (($views % 1000000 >= 999000) && ($views % 1000000 < 999990))
|
||||
// $dispviews = substr((string)$views, 0, -3) . "???";
|
||||
@ -376,15 +376,14 @@
|
||||
if (filter_bool($meta['noindex']))
|
||||
$metatag .= "<meta name=\"robots\" content=\"noindex,follow\" />";
|
||||
|
||||
if (filter_bool($meta['description']))
|
||||
if (isset($meta['description']))
|
||||
$metatag .= "<meta name=\"description\" content=\"{$meta['description']}\" />";
|
||||
|
||||
if (filter_bool($x_hacks['smallbrowse']) and false) {
|
||||
$css = "";
|
||||
$css = "<link rel='stylesheet' href='/mobile.css'>";
|
||||
if (isset($meta['canonical'])) {
|
||||
$metatag .= "<link rel='canonical' href='{$meta['canonical']}'";
|
||||
}
|
||||
|
||||
$header1="<html><head><meta http-equiv='Content-type' content='text/html; charset=utf-8'><title>$windowtitle</title>
|
||||
$header1="<html><head><meta http-equiv='Content-type' content='text/html; charset=utf-8'><meta name='viewport' content='width=device-width, initial-scale=1'><title>$windowtitle</title>
|
||||
$metatag
|
||||
<link rel=\"shortcut icon\" href=\"/favicon". (!$x_hacks['host'] ? rand(1,8) ."" : "" ) .".ico\" type=\"image/x-icon\">
|
||||
$css
|
||||
@ -400,7 +399,7 @@
|
||||
</td><tr>
|
||||
<td width='120px' class='tbl tdbg2 center fonts'><nobr>Views: $dispviews<br><img src=images/_.gif width=120 height=1></td>
|
||||
<td width='100%' class='tbl tdbg2 center fonts'>$headlinks2</td>
|
||||
<td width='120px' class='tbl tdbg2 center fonts'><nobr>". date($dateformat,ctime()+$tzoff) ."<br><img src=images/_.gif width=120 height=1><tr>"
|
||||
<td width='120px' class='tbl tdbg2 center fonts'><nobr>". date($dateformat,ctime()+$tzoff) ."<br><img src=images/_.gif width=120 height=1><tr>"
|
||||
: "<br>$dispviews views, ". date($dateformat,ctime()+$tzoff) ."
|
||||
</td><tr>
|
||||
<td width=100% class='tbl tdbg2 center fonts' colspan=3>$headlinks2</td><tr>") ."
|
||||
@ -422,16 +421,16 @@
|
||||
|
||||
$ref=filter_string($_SERVER['HTTP_REFERER']);
|
||||
$url=getenv('SCRIPT_URL');
|
||||
|
||||
|
||||
if(!$url) $url=str_replace('/etc/board','',getenv('SCRIPT_NAME'));
|
||||
$q=getenv('QUERY_STRING');
|
||||
|
||||
|
||||
if($q) $url.="?$q";
|
||||
|
||||
|
||||
if($ref && substr($ref,7,7)!="jul.rus") $sql->query("INSERT INTO referer (time,url,ref,ip) VALUES (". ctime() .", '".addslashes($url)."', '".addslashes($ref)."', '". $_SERVER['REMOTE_ADDR'] ."')");
|
||||
|
||||
$sql->query("DELETE FROM guests WHERE ip='$userip' OR date<".(ctime()-300));
|
||||
|
||||
|
||||
if($log) {
|
||||
/*
|
||||
$ulastip=mysql_result(mysql_query("SELECT lastip FROM users WHERE id=$loguserid"),0,0);
|
||||
@ -467,7 +466,7 @@
|
||||
} else {
|
||||
$sql->query("INSERT INTO guests (ip,date,useragent,lasturl) VALUES ('$userip',".ctime().",'".addslashes($_SERVER['HTTP_USER_AGENT']) ."','". addslashes($url) ."')");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -494,7 +493,7 @@
|
||||
<td>
|
||||
{$smallfont}
|
||||
Acmlmboard - <a href='https://github.com/Xkeeper0/jul'>". (file_exists('version.txt') ? file_get_contents("version.txt") : shell_exec("git log --format='commit %h [%ad]' --date='short' -n 1")) ."</a>
|
||||
<br>©2000-". date("Y") ." Acmlm, Xkeeper, Inuyasha, et al.
|
||||
<br>©2000-". date("Y") ." Acmlm, Xkeeper, Inuyasha, et al.
|
||||
</font>
|
||||
</td>
|
||||
</tr></table>
|
||||
@ -540,6 +539,3 @@ piwikTracker.enableLinkTracking();
|
||||
<br>
|
||||
<br>E-mail: xkeeper@gmail.com
|
||||
$tblend$footer");
|
||||
|
||||
|
||||
|
||||
|
19
thread.php
19
thread.php
@ -20,7 +20,7 @@
|
||||
if ($id && (filter_int($_GET['addvote']) || filter_int($_GET['delvote']))) {
|
||||
$option = (($_GET['addvote']) ? 'addvote' : 'delvote');
|
||||
$choice = filter_int($_GET[$option]);
|
||||
|
||||
|
||||
$pollid = $sql->resultq("SELECT poll FROM threads WHERE id='{$id}'");
|
||||
if (!$pollid)
|
||||
return header("Location: ?id={$id}#{$id}");
|
||||
@ -56,6 +56,9 @@
|
||||
}
|
||||
$numposts = $sql->resultq("SELECT COUNT(*) FROM `posts` WHERE `thread` = '{$id}' AND `id` < '{$pid}'");
|
||||
$page = floor($numposts / $ppp);
|
||||
|
||||
// Canonical page w/o ppp link (for bots)
|
||||
$meta['canonical'] = "thread.php?id=$id&page=$page";
|
||||
}
|
||||
|
||||
define('E_BADPOSTS', -1);
|
||||
@ -90,7 +93,7 @@
|
||||
}
|
||||
|
||||
$thread['title'] = str_replace("<", "<", $thread['title']);
|
||||
|
||||
|
||||
$forumid = intval($thread['forum']);
|
||||
$forum = $sql->fetchq("SELECT * FROM forums WHERE id=$forumid");
|
||||
|
||||
@ -175,7 +178,7 @@
|
||||
$meta['noindex'] = true; // prevent search engines from indexing what they can't access
|
||||
require_once 'lib/layout.php';
|
||||
errorpage("No thread specified.",'the index page',"index.php");
|
||||
}
|
||||
}
|
||||
|
||||
//temporary
|
||||
if ($windowtitle) $windowtitle = "$boardname -- $windowtitle";
|
||||
@ -186,7 +189,7 @@
|
||||
$fonline = fonlineusers($forumid);
|
||||
if (mysql_num_rows($sql->query("SELECT user FROM forummods WHERE forum='$forumid' and user='$loguserid'")))
|
||||
$ismod = true;
|
||||
}
|
||||
}
|
||||
$modfeats = '';
|
||||
if ($id && $ismod) {
|
||||
$trashid = 27;
|
||||
@ -354,7 +357,7 @@
|
||||
|
||||
$page = max(0, filter_int($page));
|
||||
$min = $ppp * $page;
|
||||
|
||||
|
||||
if ($user) $searchon = "user={$user}";
|
||||
else $searchon = "thread={$id}";
|
||||
|
||||
@ -392,7 +395,7 @@
|
||||
$pthread = $sql->fetchq("SELECT id,title,forum FROM threads WHERE id=$post[thread]", MYSQL_BOTH, true);
|
||||
$pforum = $sql->fetchq("SELECT minpower FROM forums WHERE id=".intval($pthread[forum]), MYSQL_BOTH, true);
|
||||
}
|
||||
|
||||
|
||||
$post['act'] = filter_int($act[$post['user']]);
|
||||
|
||||
if (!$pforum || $pforum['minpower'] <= $power)
|
||||
@ -430,7 +433,7 @@
|
||||
$pagelinks .= " ...";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($i == $page)
|
||||
$pagelinks .= " ".($i + 1);
|
||||
else
|
||||
@ -455,4 +458,4 @@ function notAuthorizedError() {
|
||||
$redir = (($log) ? 'index.php' : 'login.php');
|
||||
$rtext = (($log) ? 'the index page' : 'log in (then try again)');
|
||||
errorpage("Couldn't enter the forum. You don't have access to this restricted forum.", $rtext, $redir);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user