function do_header($title = null) { global $session, $settings, $memcache; header('Content-Type: text/html; charset=utf-8'); if ($session->level == 'anonymous') { $cached = $memcache->get('header'); if ($cached !== false) { $this->output .= $cached; return true; } } $topic = array('text' => format_whitespace(format_link($settings->topic_text)), 'nick' => $settings->topic_nick); $timestamp['core'] = md5(sprintf('%s%s', filemtime('templates/core.css'), $settings->site_key)); $timestamp['js'] = md5(sprintf('%s%s', filemtime('statics/fearqdb.js'), $settings->site_key)); $timestamp['fearqdb'] = md5(sprintf('%s%s', filemtime('statics/fearqdb.png'), $settings->site_key)); if ($settings->analytics_code) { $timestamp['ga'] = md5(sprintf('%s%s', filemtime('statics/ga.js'), $settings->site_key)); } $timestamp['zepto'] = md5(sprintf('%s%s', filemtime('statics/zepto.js'), $settings->site_key)); $vars = compact('title', 'topic', 'session', 'timestamp'); $cached = Haanga::Load('header.html', $vars, true); if ($session->level == 'anonymous') { $memcache->set('header', $cached); } $this->output .= $cached; }
function create_word_DB() { if (!file_exists("word_DB.txt")) { $word_list = ""; for ($i = 1; $i < 31; $i += 2) { $link_to_common_words = format_link($i); $contents = file_get_contents($link_to_common_words); // get the list items preg_match_all("/<li>(.*?)<\\/li>/s", $contents, $out); // copy each items content to the word list foreach ($out[1] as $ar1) { $word_list .= trim($ar1) . ","; } } file_put_contents("word_DB.txt", trim($word_list, ",")); } }
private function text_clean($text, $for = 'www_body') { // this is real crap. global $settings, $session; // clean only for www. rss uses the CDATA structure which does not require escaping if ($for == 'www_body' || $for == 'www_comment') { $text = htmlspecialchars($text); } // mark the search criterium if ($session->search && ($for == 'www_body' || $for == 'www_comment')) { $text = highlight($text, $session->search); } // clean special chars from copypasting from irc $text = preg_replace('/[\\x00-\\x09\\x0b-\\x1F\\x7F]/', '', $text); // delete timestamps $text = preg_replace('/^[\\(\\[]?\\d+:\\d+(:\\d+)?[\\)\\]]?\\s/m', '', $text); if ($for == 'www_body' || $for == 'rss_body' || $for == 'rss_title' || $for == 'excerpt') { // add * to mark actions, joins, parts etc $text = preg_replace('/^([a-z0-9\\[\\]\\{\\}_])/smi', '* $1', $text); // :D } // hack for this db. old quotes came this way. so remove this once it's fixed or remove it if you start with a db from scratch. $text = preg_replace("/^\n/", '', $text); if ($for == 'www_body') { // nicks for the website $text = preg_replace_callback('/^<[@\\+\\s]?([a-z0-9\\-\\[\\]\\{\\}_`~\\|]+)>/mi', array($this, 'nick_colour'), $text); } if ($for == 'rss_body' || $for == 'rss_title') { // escape the cdata structure (avoid injections) + nicks for rss // nicks for rss never use < or < because they DON'T WORK for rss readers // < works for some, < for some... so we use () $text = str_replace(']]>', ']]]]><![CDATA[>', $text); // http://en.wikipedia.org/wiki/CDATA#Nesting $text = preg_replace('/<[@\\+\\s]?([a-z0-9\\-\\[\\]\\{\\}_`~\\|]+)>/msi', '($1)', $text); } if ($for == 'excerpt') { $text = preg_replace('/<[@\\+\\s]?([a-z0-9\\-\\[\\]\\{\\}_`~\\|]+)>/msi', '<$1>', $text); } if ($for == 'www_body' || $for == 'rss_body' || $for == 'www_comment') { // don't add links to rss titles! $text = format_link($text); $text = str_replace("\n", '<br />', $text); // respect \s\s to fix asciis $text = format_whitespace($text); } else { $text = str_replace("\n", ' ', $text); } // cut long title if ($for == 'rss_title' || $for == 'www_tweet' || $for == 'excerpt') { if (mb_strlen($text) > 110) { $text = sprintf('%s...', mb_substr($text, 0, 110)); } } return $text; }
<embed class="page" src="<?php echo format_link(COMIC_IMAGE_FILE); ?> "></embed>
<div class="pager"><?php foreach ($pageLinks as $index => $page) { if ($page !== COMIC_PAGE) { ?> <a class="<?php echo strtolower($index); ?> " href="<?php echo format_link(COMIC_DIRECTORY . $page); ?> "><?php echo ucfirst($index); ?> </a><?php } else { ?> <span class="<?php echo strtolower($index); ?> "><?php echo ucfirst($index); ?> </span><?php } } ?> </div>
?> > <h1><a href="<?php echo format_link(""); ?> "><?php echo SITE_NAME; ?> </a></h1> <div class="menu left"> <ul> <?php foreach ($static_pages as $page => $title) { ?> <li><a href="<?php echo format_link($page); ?> "><?php echo format_page_name($title); ?> </a></li> <?php } ?> </ul> </div> <div class="menu right"> <ul> <?php foreach ($external_pages as $page => $title) { ?>
$inlineJS .= file_get_contents('static/inline.js'); $inlineJS .= '</script>'; } $javascript = ""; if (file_has_content('static/styles.css') || file_has_content('static/scripts.js')) { $javascript = '<script type="text/javascript">' . "\n"; $javascript .= 'function _() { var '; if (file_has_content('static/styles.css')) { $javascript .= 'a=document.createElement("link");'; $javascript .= 'a.rel="stylesheet";'; $javascript .= 'a.href="' . format_link('static/styles.css') . '";'; $javascript .= 'document.body.appendChild(a);'; } if (file_has_content('static/scripts.js')) { $javascript .= 'a=document.createElement("script");'; $javascript .= 'a.src="' . format_link('static/scripts.js') . '";'; $javascript .= 'document.body.appendChild(a);'; } $javascript .= '}'; $javascript .= 'document.addEventListener ? document.addEventListener("DOMContentLoaded", _) : document.attachEvent("onreadystagechange", function() {'; $javascript .= 'if (document.readyState === "interactive") { _(); }'; $javascript .= '});' . "\n"; $javascript .= '</script>' . "\n"; } $bodyClass = ' class="' . COMIC_MODE . '"'; if (defined("COMIC_BODY_CLASS")) { $bodyClass = ' class="' . COMIC_BODY_CLASS . '"'; } $pageTitle = ""; if (defined("COMIC_PAGE_TITLE") && COMIC_DEBUG != 'Landing/Splash Page') { $pageTitle = " - " . format_page_name(COMIC_PAGE_TITLE, true);
function link_message($type1, $xref1, $type2, $xref2) { return WT_I18N::translate('%1$s %2$s has a %3$s link to %4$s.', format_type($type1), format_link($xref1), format_type($type2), format_link($xref2)); }