From e6d7e71175e388b7d5e356eebb9ff350c941026e Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Sat, 28 May 2011 01:47:59 +1000 Subject: renamed "homepage" directory to "themes" --- templates/themes/basic/info.php | 27 +++++++ templates/themes/basic/theme.php | 70 +++++++++++++++++ templates/themes/basic/thumb.png | Bin 0 -> 9298 bytes templates/themes/frameset/info.php | 30 ++++++++ templates/themes/frameset/theme.php | 134 ++++++++++++++++++++++++++++++++ templates/themes/frameset/thumb.png | Bin 0 -> 7571 bytes templates/themes/recent/info.php | 28 +++++++ templates/themes/recent/recent.css | 50 ++++++++++++ templates/themes/recent/theme.php | 147 ++++++++++++++++++++++++++++++++++++ templates/themes/recent/thumb.png | Bin 0 -> 24532 bytes 10 files changed, 486 insertions(+) create mode 100644 templates/themes/basic/info.php create mode 100644 templates/themes/basic/theme.php create mode 100644 templates/themes/basic/thumb.png create mode 100644 templates/themes/frameset/info.php create mode 100644 templates/themes/frameset/theme.php create mode 100644 templates/themes/frameset/thumb.png create mode 100644 templates/themes/recent/info.php create mode 100644 templates/themes/recent/recent.css create mode 100644 templates/themes/recent/theme.php create mode 100644 templates/themes/recent/thumb.png (limited to 'templates/themes') diff --git a/templates/themes/basic/info.php b/templates/themes/basic/info.php new file mode 100644 index 00000000..bd856655 --- /dev/null +++ b/templates/themes/basic/info.php @@ -0,0 +1,27 @@ + 'Title', + 'name' => 'title', + 'type' => 'text' + ); + + $theme['config'][] = Array( + 'title' => 'Slogan', + 'name' => 'subtitle', + 'type' => 'text' + ); + + // Unique function name for building everything + $theme['build_function'] = 'basic_build'; +?> \ No newline at end of file diff --git a/templates/themes/basic/theme.php b/templates/themes/basic/theme.php new file mode 100644 index 00000000..5b086852 --- /dev/null +++ b/templates/themes/basic/theme.php @@ -0,0 +1,70 @@ +' + . '' + . '' + . '' . $settings['title'] . '' + . ''; + + $boardlist = createBoardlist(); + $body .= '
' . $boardlist['top'] . '
'; + + $body .= '

' . $settings['title'] . '

' + . '
' . ($settings['subtitle'] ? utf8tohtml($settings['subtitle']) : '') . '
'; + + $body .= '
'; + + $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'] . '

'; + } + } + + $body .= '
'; + + // Finish page + $body .= '

Powered by Tinyboard'; + + return $body; + } + }; + +?> \ No newline at end of file diff --git a/templates/themes/basic/thumb.png b/templates/themes/basic/thumb.png new file mode 100644 index 00000000..05dcd96c Binary files /dev/null and b/templates/themes/basic/thumb.png differ diff --git a/templates/themes/frameset/info.php b/templates/themes/frameset/info.php new file mode 100644 index 00000000..ad42fc91 --- /dev/null +++ b/templates/themes/frameset/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'] = 'frameset_build'; +?> \ No newline at end of file diff --git a/templates/themes/frameset/theme.php b/templates/themes/frameset/theme.php new file mode 100644 index 00000000..6aa126c8 --- /dev/null +++ b/templates/themes/frameset/theme.php @@ -0,0 +1,134 @@ +' + . '' + . '' + . '' + . '' . $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'] . '
'; + + + $body .= '
Boards
'; + + // Finish page + $body .= ''; + + return $body; + } + }; + +?> \ No newline at end of file diff --git a/templates/themes/frameset/thumb.png b/templates/themes/frameset/thumb.png new file mode 100644 index 00000000..df18a8e9 Binary files /dev/null and b/templates/themes/frameset/thumb.png differ diff --git a/templates/themes/recent/info.php b/templates/themes/recent/info.php new file mode 100644 index 00000000..734908c4 --- /dev/null +++ b/templates/themes/recent/info.php @@ -0,0 +1,28 @@ + 'Title', + 'name' => 'title', + 'type' => 'text' + ); + + $theme['config'][] = Array( + 'title' => 'Excluded boards', + 'name' => 'exclude', + 'type' => 'text', + 'comment' => '(space seperated)' + ); + + // Unique function name for building everything + $theme['build_function'] = 'recentposts_build'; +?> \ No newline at end of file diff --git a/templates/themes/recent/recent.css b/templates/themes/recent/recent.css new file mode 100644 index 00000000..7b9f2333 --- /dev/null +++ b/templates/themes/recent/recent.css @@ -0,0 +1,50 @@ +.box-wrap { + max-width: 670px; + min-width: 332px; + margin: 30px auto; + overflow: auto; + padding: 0; +} +.box { + background: white; + border: 1px solid #98E; + width: 330px; + margin: 8px 0; + padding: 0; +} +.box ul { + padding: 2px 15px; +} +.box ul li { + list-style: none; + margin: 0; +} +.box.left { + background: #efe; + color: #060; + border: 1px solid #060; + float: left; +} +.box.right { + background: #eef; + color: #006; + border: 1px solid #006; + float: right; +} + +.box h2 { + padding: 3px 7px; + font-size: 12pt; +} +.box.left h2 { + background: #9C6; + color: #060; +} +.box.right h2 { + background: #59A; + color: white; +} +.box img { + float: none; + margin: 10px auto; +} \ No newline at end of file diff --git a/templates/themes/recent/theme.php b/templates/themes/recent/theme.php new file mode 100644 index 00000000..764c4170 --- /dev/null +++ b/templates/themes/recent/theme.php @@ -0,0 +1,147 @@ +build($action, $settings); + } + + // Wrap functions in a class so they don't interfere with normal Tinyboard operations + class RecentPosts { + public function build($action, $settings) { + global $config, $_theme; + + if($action == 'all') { + //copy($config['dir']['homepage'] . '/' . $_theme . '/recent.css', $config['dir']['home'] . 'recent.css'); + } + + $this->excluded = explode(' ', $settings['exclude']); + + if($action == 'all' || $action == 'post') + // file_put_contents($config['dir']['home'] . $config['file_index'], $this->homepage($settings)); + file_write($config['dir']['home'] . 'recent.html', $this->homepage($settings)); + } + + // Build news page + public function homepage($settings) { + global $config, $board; + + // HTML5 + $body = '' + . '' + . '' + . '' + . '' . $settings['title'] . '' + . ''; + + $boardlist = createBoardlist(); + $body .= '
' . $boardlist['top'] . '
'; + + $body .= '

' . $settings['title'] . '

'; + + + $boards = listBoards(); + + // Wrap + $body .= '
'; + + // Recent images + $body .= '

Recent Images

    '; + $query = ''; + foreach($boards as &$_board) { + if(in_array($_board['uri'], $this->excluded)) + continue; + $query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` WHERE `file` IS NOT NULL UNION ALL ", $_board['uri'], $_board['uri']); + } + $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT 3', $query); + $query = query($query) or error(db_error()); + + while($post = $query->fetch()) { + openBoard($post['board']); + + $body .= '
  • '; + } + $body .= '
'; + + // Latest posts + $body .= '

Latest Posts

    '; + $query = ''; + foreach($boards as &$_board) { + if(in_array($_board['uri'], $this->excluded)) + continue; + $query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` UNION ALL ", $_board['uri'], $_board['uri']); + } + $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT 30', $query); + $query = query($query) or error(db_error()); + + while($post = $query->fetch()) { + openBoard($post['board']); + + $body .= '
  • ' . $board['name'] . ': ' . pm_snippet($post['body'], 30) . '
  • '; + } + + $body .= '
'; + + + // Stats + $body .= '

Stats

    '; + + // Total posts + $query = 'SELECT SUM(`top`) AS `count` FROM ('; + foreach($boards as &$_board) { + if(in_array($_board['uri'], $this->excluded)) + continue; + $query .= sprintf("SELECT MAX(`id`) AS `top` FROM `posts_%s` UNION ALL ", $_board['uri']); + } + $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); + $query = query($query) or error(db_error()); + $res = $query->fetch(); + $body .= '
  • Total posts: ' . number_format($res['count']) . '
  • '; + + // Unique IPs + $query = 'SELECT COUNT(DISTINCT(`ip`)) AS `count` FROM ('; + foreach($boards as &$_board) { + if(in_array($_board['uri'], $this->excluded)) + continue; + $query .= sprintf("SELECT `ip` FROM `posts_%s` UNION ALL ", $_board['uri']); + } + $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); + $query = query($query) or error(db_error()); + $res = $query->fetch(); + $body .= '
  • Unique posters: ' . number_format($res['count']) . '
  • '; + + // Active content + $query = 'SELECT SUM(`filesize`) AS `count` FROM ('; + foreach($boards as &$_board) { + if(in_array($_board['uri'], $this->excluded)) + continue; + $query .= sprintf("SELECT `filesize` FROM `posts_%s` UNION ALL ", $_board['uri']); + } + $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); + $query = query($query) or error(db_error()); + $res = $query->fetch(); + $body .= '
  • Active content: ' . format_bytes($res['count']) . '
  • '; + + $body .= '
'; + + // End wrap + $body .= '
'; + + // Finish page + $body .= '

Powered by Tinyboard'; + + return $body; + } + }; + +?> \ No newline at end of file diff --git a/templates/themes/recent/thumb.png b/templates/themes/recent/thumb.png new file mode 100644 index 00000000..fff5b824 Binary files /dev/null and b/templates/themes/recent/thumb.png differ -- cgit v1.3