daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     $f = 'cache/latestnews.tmp';
  3.     if(($m=@filemtime($f)) && $m >= time() - 10)
  4.         readfile($f);
  5.     else {
  6.         ob_start();
  7.         echo '<table style="width: 100%;text-align: center;">';
  8.         echo readfile('cache/topguilds.tmp');
  9.         echo '</table><hr/><table style="width: 100%;text-align: center;">';
  10.         echo readfile('cache/countries.tmp').'</table><br/><br/>';
  11.         $news = query('SELECT post_topic,post_date,post_text,z_forum.id FROM z_forum WHERE section=1 AND z_forum.id=first_post ORDER BY post_date DESC LIMIT 5')->fetchAll();
  12.         $last = count($news) - 1;
  13.         foreach($news as $i => $q) {
  14.             $replies = (int)query('SELECT COUNT(*) FROM z_forum WHERE first_post = '.$q['id'].' AND id != '.$q['id'])->fetchColumn();
  15.             foreach(array(
  16.                 '/\[url](.*?)\[\/url\]/is' => '<a href=$1 target="_blank">$1</a>',
  17.                 '/\[url=(.*?)\](.*?)\[\/url\]/is' => '<a href=\'$1\' target="_blank">$2</a>',
  18.                 '/\[img](.*?)\[\/img\]/is' => '<a href=$1 target="_blank"><img src=$1 target="_blank" style="border: 0px; max-width: 100%;"/></a>',
  19.                 '/\[b\](.*?)\[\/b\]/is' => '<b>$1</b>',
  20.                 '/\[i\](.*?)\[\/i\]/is' => '<i>$1</i>',
  21.                 '/\[u\](.*?)\[\/u\]/is' => '<u>$1</u>'
  22.             ) as $k => $v)
  23.                 $q[2] = preg_replace($k, $v, $q[2]);
  24.             $q[2] = str_replace(">\r\n", '>', $q[2]); ?>
  25.     <div class="title1">
  26.         <h2><a href="/forum/thread/<?=$q[3]?>" style="color: #fff; text-decoration: none"><?=$q[0]?></a> &ndash; <?=date('M d Y, H:i:s', $q['post_date'])?></h2>
  27.     </div>
  28.     <div class="box-style1">
  29.         <div class="entry">
  30.             <p class="text-align">
  31. <?=nl2br($q[2])?>
  32.             </p>
  33.             <div class="meta" style="overflow: hidden;">
  34.                 <p style="float: left;">Posted in <a href="/forum">Forum</a>, <a href="/forum/1">News</a></p>
  35.                 <p style="float: right;">
  36.                     <span class="more"><a href="/forum/thread/<?=$q[3]?>"><?=$replies?> comment<?=($replies === 1 ? '' : 's')?></a></span>
  37.                     <span class="divider"> | </span>
  38.                     <span class="comments"><a href="/forum/thread/<?=$q[3]?>">Full Post</a></span>
  39.                 </p>
  40.             </div>
  41.         </div>
  42.     </div>
  43.     <hr/>
  44. <?      }
  45.         $str = ob_get_clean();
  46.         file_put_contents($f, $str);
  47.         echo $str;
  48.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top