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