function commaize($n) { $n = strval($n); return intval($n) < 1000 ? $n : commaize(substr($n, 0, -3)) . ',' . substr($n, -3); }
$stripped_whitespace = preg_replace('/[\\s]/u', '', $post['body']); if ($stripped_whitespace == '') { error($config['error']['tooshort_body']); } } // Check if thread is locked // but allow mods to post if (!$OP && !hasPermission($config['mod']['postinlocked'], $board['uri'])) { if ($thread['locked']) { error($config['error']['locked']); } } if ($post['has_file']) { $size = $_FILES['file']['size']; if ($size > $config['max_filesize']) { error(sprintf3($config['error']['filesize'], array('sz' => commaize($size), 'filesz' => commaize($size), 'maxsz' => commaize($config['max_filesize'])))); } } if ($mod && $mod['type'] >= MOD && preg_match('/^((.+) )?## (.+)$/', $post['name'], $match)) { if ($mod['type'] == MOD && $match[3] == 'Mod' || $mod['type'] >= ADMIN) { $post['capcode'] = utf8tohtml($match[3]); $post['name'] = $match[2] != '' ? $match[2] : $config['anonymous']; } } else { $post['capcode'] = false; } $trip = generate_tripcode($post['name']); $post['name'] = $trip[0]; $post['trip'] = isset($trip[1]) ? $trip[1] : ''; if (strtolower($post['email']) == 'noko') { $noko = true;
<p class=summary style="margin-bottom: 4px;">took <?php echo round($onLoad / 1000, 1); ?> seconds to load <?php echo round($pageData['bytesTotal'] / 1024); ?> kB of data over <?php echo $pageData['reqTotal']; ?> requests.</p> <div style="margin-top: 0.5em;"> <a href="<?php echo rankUrl($url); ?> ">Alexa rank: <?php echo commaize($gRank); ?> </a> <span style="margin-left: 3em;">view on <?php if ($gbMobile || $gbAndroid) { echo "<a href='http://httparchive.org/viewsite.php?u={$urlencoded}'>desktop</a> or "; } else { if ($gRank <= 5000) { // TODO - This is terribly hardwired. echo "<a href='http://mobile.httparchive.org/viewsite.php?u={$urlencoded}'>mobile</a> or "; } } ?> <a href="https://web.archive.org/web/*/<?php echo $url;
function addUrlToForm($url, $action, $createDate, $bSimilar = true) { global $giUrl, $gUrlsTable; $sRow = ""; // Find similar URLs. $sSimilar = ""; if ($bSimilar) { $sld = secondLevelDomain($url); $iSimilar = 0; $nSim = 3; $query = "select urlOrig, urlFixed, rank, other from {$gUrlsTable} where urlOrig like '%.{$sld}%' or urlOrig like '%/{$sld}%' or urlFixed like '%.{$sld}%' or urlFixed like '%/{$sld}%' order by rank asc limit {$nSim};"; $result = doQuery($query); while ($row = mysql_fetch_assoc($result)) { $iSimilar++; if ($iSimilar <= $nSim) { $urlsim = $row['urlFixed'] ? $row['urlFixed'] : $row['urlOrig']; if ($url === $urlsim) { if ($row['other']) { // The URL supplied by the user is ALREADY in the urls table and is ALREADY other=true. There's nothing more we can do. BAIL! rejectUrl($url); // remove it from the urlschange table return ""; } else { if ("add" === $action) { // The URL is already in the urls table, so instead of "add" ask if we want to set other=true $action = "other"; } } } $rank = $row['rank'] ? commaize($row['rank']) : "not ranked"; $other = $row['other'] ? "other" : "!other"; $sSimilar .= ($sSimilar ? "<br>" : "") . "{$urlsim} ({$rank}, {$other})"; if (1 === $iSimilar && "add" == $action && $url != $urlsim && !$row['other']) { // In many cases people request "http://example.com" but "http://www.example.com" is already in the list. // In this case we want to set other=true for http://www.example.com, so we add that as a new row. // The admin can REJECT http://example.com/, and approve http://www.example.com/. $sRow .= addUrlToForm($urlsim, "other", time(), false); } } } mysql_free_result($result); if ($iSimilar > $nSim) { $sSimilar .= "<br>" . ($iSimilar - $nSim) . " more..."; } } $sRow = "<tr> <td><a href='{$url}'>{$url}</td> <td>" . date("h:ia m/d/Y", $createDate) . "</td>" . " <td>{$sSimilar}</td> <input type=hidden name=u{$giUrl} value='" . urlencode($url) . "'>" . " <td><nobr><input type=radio name=a{$giUrl} value='{$action}' style='vertical-align: top;' checked> {$action}</nobr></td> " . " <td><nobr><input type=radio name=a{$giUrl} value='" . ("other" === $action ? "ignore" : "reject") . "' style='vertical-align: top;'> " . ("other" === $action ? "ignore" : "reject") . "</nobr></td> " . "</tr>\n" . $sRow; // in case there's a similar row $giUrl++; return $sRow; }
function commaize($num) { $sNum = "{$num}"; $len = strlen($sNum); if ($len <= 3) { return $sNum; } return commaize(substr($sNum, 0, $len - 3)) . "," . substr($sNum, $len - 3); }