mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-10-13 18:04:54 +02:00
Importing Znote AAC 1.5_SVN rev 168 to github.
This commit is contained in:
51
index.php
Normal file
51
index.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
if ($config['allowSubPages'] && file_exists("layout/sub/index.php")) include 'layout/sub/index.php';
|
||||
else {
|
||||
$cache = new Cache('engine/cache/news');
|
||||
if ($cache->hasExpired()) {
|
||||
$news = fetchAllNews();
|
||||
|
||||
$cache->setContent($news);
|
||||
$cache->save();
|
||||
} else {
|
||||
$news = $cache->load();
|
||||
}
|
||||
|
||||
// Design and present the list
|
||||
if ($news) {
|
||||
function TransformToBBCode($string) {
|
||||
$tags = array(
|
||||
'[center]{$1}[/center]' => '<center>$1</center>',
|
||||
'[b]{$1}[/b]' => '<b>$1</b>',
|
||||
'[size={$1}]{$2}[/size]' => '<font size="$1">$2</font>',
|
||||
'[img]{$1}[/img]' => '<a href="$1" target="_BLANK"><img src="$1" alt="image" style="width: 100%"></a>',
|
||||
'[link]{$1}[/link]' => '<a href="$1">$1</a>',
|
||||
'[link={$1}]{$2}[/link]' => '<a href="$1" target="_BLANK">$2</a>',
|
||||
'[color={$1}]{$2}[/color]' => '<font color="$1">$2</font>',
|
||||
'[*]{$1}[/*]' => '<li>$1</li>',
|
||||
);
|
||||
foreach ($tags as $tag => $value) {
|
||||
$code = preg_replace('/placeholder([0-9]+)/', '(.*?)', preg_quote(preg_replace('/\{\$([0-9]+)\}/', 'placeholder$1', $tag), '/'));
|
||||
$string = preg_replace('/'.$code.'/i', $value, $string);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
foreach ($news as $n) {
|
||||
?>
|
||||
<table id="news">
|
||||
<tr class="yellow">
|
||||
<td class="zheadline"><?php echo getClock($n['date'], true) .' by <a href="characterprofile.php?name='. $n['name'] .'">'. $n['name'] .'</a> - <b>'. TransformToBBCode($n['title']) .'</b>'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p><?php echo TransformToBBCode(nl2br($n['text'])); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
echo '<p>No news exist.</p>';
|
||||
}
|
||||
}
|
||||
include 'layout/overall/footer.php'; ?>
|
Reference in New Issue
Block a user