1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-27 08:50:59 +01:00
vichan/templates/themes/frameset/theme.php

62 lines
1.7 KiB
PHP
Raw Normal View History

2011-04-13 15:47:47 +02:00
<?php
2011-04-14 14:12:56 +02:00
require 'info.php';
2011-04-13 15:47:47 +02:00
function frameset_build($action, $settings, $board) {
2011-04-14 14:12:56 +02:00
// Possible values for $action:
// - all (rebuild everything, initialization)
// - news (news has been updated)
// - boards (board list changed)
Frameset::build($action, $settings);
2011-04-13 15:47:47 +02:00
}
2011-04-14 14:12:56 +02:00
2011-04-13 15:47:47 +02:00
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
class Frameset {
2011-04-14 12:43:34 +02:00
public static function build($action, $settings) {
2011-04-13 15:47:47 +02:00
global $config;
2012-05-05 17:33:10 +02:00
if ($action == 'all')
file_write($config['dir']['home'] . $settings['file_main'], Frameset::homepage($settings));
2011-04-14 12:43:34 +02:00
2012-05-05 17:33:10 +02:00
if ($action == 'all' || $action == 'boards')
file_write($config['dir']['home'] . $settings['file_sidebar'], Frameset::sidebar($settings));
2011-04-14 12:43:34 +02:00
2012-05-05 17:33:10 +02:00
if ($action == 'all' || $action == 'news')
file_write($config['dir']['home'] . $settings['file_news'], Frameset::news($settings));
2011-04-13 15:47:47 +02:00
}
// Build homepage
public static function homepage($settings) {
global $config;
return Element('themes/frameset/frames.html', Array('config' => $config, 'settings' => $settings));
2011-04-13 15:47:47 +02:00
}
2011-04-13 16:24:49 +02:00
// Build news page
public static function news($settings) {
global $config;
$query = query("SELECT * FROM `news` ORDER BY `time` DESC") or error(db_error());
$news = $query->fetchAll(PDO::FETCH_ASSOC);
2011-04-13 16:24:49 +02:00
return Element('themes/frameset/news.html', Array(
'settings' => $settings,
'config' => $config,
'news' => $news
));
2011-04-13 16:24:49 +02:00
}
2011-04-13 15:47:47 +02:00
// Build sidebar
public static function sidebar($settings) {
global $config, $board;
return Element('themes/frameset/sidebar.html', Array(
'settings' => $settings,
'config' => $config,
'boards' => listBoards()
));
2011-04-13 15:47:47 +02:00
}
};
2011-07-12 15:41:20 +02:00
?>