2011-04-13 20:33:18 +02:00
|
|
|
<?php
|
2011-04-14 14:12:56 +02:00
|
|
|
require 'info.php';
|
2011-04-13 20:33:18 +02:00
|
|
|
|
2011-04-14 14:12:56 +02:00
|
|
|
function basic_build($action, $settings) {
|
|
|
|
// Possible values for $action:
|
|
|
|
// - all (rebuild everything, initialization)
|
|
|
|
// - news (news has been updated)
|
|
|
|
// - boards (board list changed)
|
|
|
|
|
|
|
|
Basic::build($action, $settings);
|
2011-04-13 20:33:18 +02:00
|
|
|
}
|
2011-04-14 14:12:56 +02:00
|
|
|
|
2011-04-13 20:33:18 +02:00
|
|
|
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
|
|
|
|
class Basic {
|
2011-04-14 12:43:34 +02:00
|
|
|
public static function build($action, $settings) {
|
2011-04-13 20:33:18 +02:00
|
|
|
global $config;
|
|
|
|
|
2012-05-05 17:33:10 +02:00
|
|
|
if ($action == 'all' || $action == 'news')
|
2012-02-08 09:20:08 +01:00
|
|
|
file_write($config['dir']['home'] . $settings['file'], Basic::homepage($settings));
|
2011-04-13 20:33:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Build news page
|
|
|
|
public static function homepage($settings) {
|
|
|
|
global $config;
|
|
|
|
|
2012-02-08 09:20:08 +01:00
|
|
|
$settings['no_recent'] = (int) $settings['no_recent'];
|
|
|
|
|
|
|
|
$query = query("SELECT * FROM `news` ORDER BY `time` DESC" . ($settings['no_recent'] ? ' LIMIT ' . $settings['no_recent'] : '')) or error(db_error());
|
2012-02-07 23:08:13 +01:00
|
|
|
$news = $query->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
|
|
|
|
return Element('themes/basic/index.html', Array(
|
2012-02-14 10:24:20 +01:00
|
|
|
'settings' => $settings,
|
|
|
|
'config' => $config,
|
|
|
|
'boardlist' => createBoardlist(),
|
|
|
|
'news' => $news
|
|
|
|
));
|
2011-04-13 20:33:18 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-10-06 14:26:07 +02:00
|
|
|
?>
|