From d3fb010a8fd2862ed6619b9cbdefb22aa9bace9c Mon Sep 17 00:00:00 2001 From: "Michael D. Reiley" Date: Tue, 20 Sep 2011 12:49:07 -0700 Subject: [PATCH] New "Categories" theme, modifications for support. --- inc/config.php | 11 +++ inc/functions.php | 10 +++ templates/themes/categories/info.php | 30 +++++++ templates/themes/categories/theme.php | 144 ++++++++++++++++++++++++++++++++++ templates/themes/categories/thumb.png | Bin 0 -> 8442 bytes 5 files changed, 195 insertions(+) create mode 100644 templates/themes/categories/info.php create mode 100644 templates/themes/categories/theme.php create mode 100644 templates/themes/categories/thumb.png diff --git a/inc/config.php b/inc/config.php index 0a8b982d..1b36f210 100644 --- a/inc/config.php +++ b/inc/config.php @@ -710,6 +710,17 @@ // 'status' => 'http://status.example.org/' //); + // Categories + // Required for the Categories theme. Array of the names of board groups in order, from $config['boards']. + //$config['categories'] = Array('groupname', 'name', 'anothername', 'kangaroos'); + + // Custom_categories + // Optional for the Categories theme. Array of name => (title, url) groups for categories with non-board links. + //$config['custom_categories'] = Array( 'Links' => + // Array('Tinyboard' => 'http://tinyboard.org', + // 'AnotherName' => 'url') + //); + // Set custom locations for stylesheets, scripts and maybe a banner. // This can be good for load balancing across multiple servers or hostnames. // $config['url_stylesheet'] = 'http://static.example.org/style.css'; // main/base stylesheet diff --git a/inc/functions.php b/inc/functions.php index a5c8a518..7ba2278b 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -228,6 +228,16 @@ } else return false; } + function boardTitle($uri) { + $query = prepare("SELECT `title` FROM `boards` WHERE `uri` = :uri LIMIT 1"); + $query->bindValue(':uri', $uri); + $query->execute() or error(db_error($query)); + + if($title = $query->fetch()) { + return $title['title']; + } else return false; + } + function purge($uri) { global $config, $debug; if(preg_match($config['url_match'], $config['root'])) { diff --git a/templates/themes/categories/info.php b/templates/themes/categories/info.php new file mode 100644 index 00000000..d0cedb13 --- /dev/null +++ b/templates/themes/categories/info.php @@ -0,0 +1,30 @@ + 'Title', + 'name' => 'title', + 'type' => 'text' + ); + + $theme['config'][] = Array( + 'title' => 'Slogan', + 'name' => 'subtitle', + 'type' => 'text' + ); + + // Unique function name for building everything + $theme['build_function'] = 'categories_build'; +?> diff --git a/templates/themes/categories/theme.php b/templates/themes/categories/theme.php new file mode 100644 index 00000000..c126f8da --- /dev/null +++ b/templates/themes/categories/theme.php @@ -0,0 +1,144 @@ +' + . '' + . '' + . '' + . '' . $settings['title'] . '' + . '' + // Sidebar + . '' + // Main + . '' + // Finish page + . ''; + } + + // Build news page + public static function news($settings) { + global $config; + + // HTML5 + $body = '' + . '' + . '' + . 'News' + . ''; + + $body .= '

' . $settings['title'] . '

' + . '
' . ($settings['subtitle'] ? utf8tohtml($settings['subtitle']) : '') . '
'; + + $query = query("SELECT * FROM `news` ORDER BY `time` DESC") or error(db_error()); + if($query->rowCount() == 0) { + $body .= '

(No news to show.)

'; + } else { + // List news + while($news = $query->fetch()) { + $body .= '
' . + '

' . + ($news['subject'] ? + $news['subject'] + : + 'no subject' + ) . + ' — by ' . + $news['name'] . + ' at ' . + date($config['post_date'], $news['time']) . + '

' . $news['body'] . '

'; + } + } + + // Finish page + $body .= ''; + + return $body; + } + + // Build sidebar + public static function sidebar($settings) { + global $config, $board; + + $body = '' + . '' + . '' + . '' + . '' + . '' . $settings['title'] . '' + . ''; + + $body .= '
' . $settings['title'] . '
'; + + for($cat = 0; $cat < count($config['categories']); $cat++) { + $body .= '
' . $config['categories'][$cat] . '
'; + } + + foreach($config['custom_categories'] as $name => &$group) { + $body .= '
' . $name . '
'; + } + + // Finish page + $body .= ''; + + return $body; + } + }; + +?> diff --git a/templates/themes/categories/thumb.png b/templates/themes/categories/thumb.png new file mode 100644 index 0000000000000000000000000000000000000000..4326ee35b6487df7a7b4da57bfc1c01b6620eec8 GIT binary patch literal 8442 zcmVPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipl0 z6D<@%)^|<-000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_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