admin avatar

基于PHP实现类似于4chan开源网站图像的公告板程序-tinyib

🕒 by admin

4chan是一个简单的基于图像的公告板,任何人都可以发表评论和分享图像。有专门用于各种主题的板块,从日本动画和文化到视频游戏,音乐和摄影。用户在加入社区之前不需要注册帐户。随意点击下面你感兴趣的板子,然后直接跳进去

事实上你可以理解为4chan也是类似于Reddit,但是Reddit用户和流量是顶级的。

不过4chan流量也不低,摘自官方介绍

4chan由主机代管服务器和CDN(CloudFlare)提供支持,使我们能够每天提供超过100TB的数据,每月为超过2200万独立访问者提供超过6.8亿次页面浏览量!

找到了一款基于PHP实现类似于4chan开源网站图像的公告板程序tinyib

tinyib功能如下

使用MySQL,PostgreSQL或SQLite进行能够处理大量流量,没有数据库?可将帖子存储为文本文件,以便能够在几乎任何PHP主机上运行的便携式设置。TinyIB能够在不需要图像的情况下允许新的公告,或者完全不允许图像。

  • GIF,JPG,PNG,SWF,MP4和WebM上传。
  • YouTube,Vimeo和SoundCloud嵌入。
  • 验证码:
  • 参考链接。>>###
  • 自动获取新回复。(请参见TINYIB_AUTOREFRESH)
  • 通过密码删除帖子。
  • 举报帖子。
  • 屏蔽关键字。
  • 管理面板:
    • 账户系统:
      • 超级用户(所有权限)
      • 管理员(除帐户管理之外的所有权限)
      • 版主(只能粘性话题、锁定话题、批准帖子和删除帖子)
    • 禁止在所有董事会上发布冒犯性/辱骂性海报。
    • 使用原始 HTML 发布。
    • 通过 git 安装时自动升级。(仅在 Linux 上测试)

下面是tinyib的安装和配置教程

1
2
3
4
apt-get install ffmpeg
git clone https://code.rocketnine.space/tslocum/tinyib.git
cd tinyib
Copy settings.default.php  settings.php

下面是配置文件,自行修改

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
/*
TinyIB
https://code.rocketnine.space/tslocum/tinyib

Support:
https://code.rocketnine.space/tslocum/tinyib/issues

See README for instructions on configuring, moderating and upgrading your board.

Set TINYIB_DBMODE to a MySQL-related mode if it's available. By default it's set
to flatfile, which can be very slow.

Many settings require the imageboard to be rebuilt to take effect. To do this,
click Rebuild All in the management panel.
*/

// Internationalization
define('TINYIB_LOCALE', '');                      // 网站语言  ['' to run in English]
define('TINYIB_TIMEZONE', 'UTC');                 // 网站时区 - e.g. America/Los_Angeles
define('TINYIB_DATEFMT', '%g/%m/%d(%a)%H:%M:%S'); // Date and time format  (see php.net/strftime)

// Board description and behavior
//   Warning: Enabling reCAPTCHA will cause all visitors to be tracked by Google.  See https://nearcyan.com/you-probably-dont-need-recaptcha/
define('TINYIB_BOARD', 'b');          // Unique identifier for this board using only letters and numbers
define('TINYIB_BOARDDESC', 'TinyIB'); // 网站显示名称
define('TINYIB_BOARDTITLE', '');      // 网站title.  When blank, defaults to TINYIB_BOARDDESC (when set) or "TinyIB"
define('TINYIB_ALWAYSNOKO', false);   // Redirect to thread after posting
define('TINYIB_CAPTCHA', '');         // 网站三种验证码实现: simple / hcaptcha / recaptcha  ['' to disable]
define('TINYIB_REPLYCAPTCHA', '');    // Reduce spam by requiring users to pass a CAPTCHA when posting a reply: simple / hcaptcha / recaptcha  ['' to disable]
define('TINYIB_REPORTCAPTCHA', '');   // Reduce invalid reports by requiring users to pass a CAPTCHA when reporting: simple / hcaptcha / recaptcha  ['' to disable]
define('TINYIB_MANAGECAPTCHA', '');   // Improve security by requiring users to pass a CAPTCHA when logging in to the management panel: simple / hcaptcha / recaptcha  ['' to disable]
define('TINYIB_REPORT', false);       // Allow users to report posts
define('TINYIB_AUTOHIDE', 0);         // Amount of reports which will cause a post to be hidden until it is approved  [0 to disable]
define('TINYIB_REQMOD', '');          // Require moderation before displaying posts: files / all  ['' to disable]
define('TINYIB_BANMESSAGE', true);    // Allow staff to append a custom message to posts when banning users
define('TINYIB_UPDATEBUMPED', true);  // Update thread position when a reply is deleted
define('TINYIB_SPOILERTEXT', false);  // Allow users to hide text until it is hovered over using the tags <s>text here</s> or <spoiler>text here</spoiler>
define('TINYIB_SPOILERIMAGE', false); // Allow users to blur thumbnails via a "Spoiler" checkbox
define('TINYIB_AUTOREFRESH', 30);     // Delay (in seconds) between attempts to refresh a thread automatically  [0 to disable]
define('TINYIB_CLOUDFLARE', false);   // Only enable when the site is served via Cloudflare to identify IP addresses correctly
define('TINYIB_DISALLOWTHREADS', ''); // When set, users attempting to post a new thread are shown this message instead  ['' to disable]
define('TINYIB_DISALLOWREPLIES', ''); // When set, users attempting to post a reply are shown this message instead  ['' to disable]

// Board appearance
define('TINYIB_INDEX', 'index.html'); // Index file
define('TINYIB_LOGO', '');            // Logo HTML
define('TINYIB_THREADSPERPAGE', 10);  // Amount of threads shown per index page
define('TINYIB_PREVIEWREPLIES', 3);   // Amount of replies previewed on index pages
define('TINYIB_TRUNCATE', 15);        // Messages are truncated to this many lines on board index pages  [0 to disable]
define('TINYIB_WORDBREAK', 80);       // Words longer than this many characters will be broken apart  [0 to disable]
define('TINYIB_EXPANDWIDTH', 85);     // Expanded content size as a percentage of the screen's width
define('TINYIB_BACKLINKS', true);     // Display reflinks to replies that reference a post
define('TINYIB_CATALOG', true);       // Generate catalog page
define('TINYIB_JSON', true);          // Generate JSON files
define('TINYIB_DEFAULTSTYLE', 'futaba'); // Default page style
$tinyib_hidefieldsop = array();       // Fields to hide when creating a new thread - e.g. array('name', 'email', 'subject', 'message', 'file', 'embed', 'password')
$tinyib_hidefields = array();         // Fields to hide when replying
$tinyib_anonymous = array('Anonymous'); // Default name (or names)
$tinyib_capcodes = array(array('Admin', 'red'), array('Mod', 'purple')); // Administrator and moderator capcode label and color
// Stylesheets (located in css)
//   Format: File name excluding extension => Title
$tinyib_stylesheets = array(
	'futaba' => 'Futaba',
	'burichan' => 'Burichan'
);

// Post control
define('TINYIB_DELAY', 30);           // Delay (in seconds) between posts from the same IP address to help control flooding  [0 to disable]
define('TINYIB_MAXTHREADS', 100);     // Oldest threads are discarded when the thread count passes this limit  [0 to disable]
define('TINYIB_MAXREPLIES', 0);       // Maximum replies before a thread stops bumping  [0 to disable]
define('TINYIB_MAXNAME', 75);         // Maximum name length  [0 to disable]
define('TINYIB_MAXEMAIL', 320);       // Maximum email length  [0 to disable]
define('TINYIB_MAXSUBJECT', 75);      // Maximum subject length  [0 to disable]
define('TINYIB_MAXMESSAGE', 8000);    // Maximum message length  [0 to disable]

// Upload types
//   Empty array to disable
//   Format: MIME type => (extension, optional thumbnail)
$tinyib_uploads = array('image/jpeg'                    => array('jpg'),
                        'image/pjpeg'                   => array('jpg'),
                        'image/png'                     => array('png'),
                        'image/gif'                     => array('gif'));
//                      'application/x-shockwave-flash' => array('swf', 'swf_thumbnail.png');
//                      'audio/aac'                     => array('aac');
//                      'audio/flac'                    => array('flac');
//                      'audio/ogg'                     => array('ogg');
//                      'audio/opus'                    => array('opus');
//                      'audio/mp3'                     => array('mp3');
//                      'audio/mpeg'                    => array('mp3');
//                      'audio/mp4'                     => array('mp4');
//                      'audio/wav'                     => array('wav');
//                      'audio/webm'                    => array('webm');
//                      'video/mp4'                     => array('mp4'); // Video uploads require ffmpeg  (see README for instructions)
//                      'video/webm'                    => array('webm');

// oEmbed APIs
//   Empty array to disable
$tinyib_embeds = array('SoundCloud' => 'https://soundcloud.com/oembed?format=json&url=TINYIBEMBED',
                       'Vimeo'      => 'https://vimeo.com/api/oembed.json?url=TINYIBEMBED',
                       'YouTube'    => 'https://www.youtube.com/oembed?url=TINYIBEMBED&format=json');

// File control
define('TINYIB_MAXKB', 2048);         // Maximum file size in kilobytes  [0 to disable]
define('TINYIB_MAXKBDESC', '2 MB');   // Human-readable representation of the maximum file size
define('TINYIB_THUMBNAIL', 'gd');     // Thumbnail method to use: gd / ffmpeg / imagemagick  (see README for instructions)
define('TINYIB_UPLOADVIAURL', false); // Allow files to be uploaded via URL
define('TINYIB_STRIPMETADATA', false);// Attempt to strip all metadata from uploaded files  (requires ExifTool)
define('TINYIB_NOFILEOK', false);     // 设置为true,时允许用户不上传图片发布新帖子,

// Thumbnail size - new thread
define('TINYIB_MAXWOP', 250);         // Width
define('TINYIB_MAXHOP', 250);         // Height

// Thumbnail size - reply
define('TINYIB_MAXW', 250);           // Width
define('TINYIB_MAXH', 250);           // Height

// Tripcode seed - Must not change once set!
define('TINYIB_TRIPSEED', '');        // 随机密匙,自行生成,这是必须等  (used when generating secure tripcodes, hashing passwords and hashing IP addresses)

// CAPTCHA - hCaptcha / reCAPTCHA
//   The following settings only apply when using hcaptcha
//   For API keys visit https://dashboard.hcaptcha.com/signup
define('TINYIB_HCAPTCHA_SITE', '');   // Site key
define('TINYIB_HCAPTCHA_SECRET', ''); // Secret key
//   The following settings only apply when using recaptcha
//   For API keys visit https://www.google.com/recaptcha
define('TINYIB_RECAPTCHA_SITE', '');  // Site key
define('TINYIB_RECAPTCHA_SECRET', '');// Secret key

// Management panel
define('TINYIB_MANAGEKEY', '');       // When set, the [Manage] link is hidden and the management panel may only be accessed via imgboard.php?manage=TINYIB_MANAGEKEY  ['' to disable]
//   Administrator and moderator passwords
//     When TINYIB_ADMINPASS is set, an administrator account is created with username "admin"
//     When TINYIB_MODPASS is set, a moderator account is created with username "moderator"
//     These settings are for installation and anti-lockout purposes only
//     Once the account(s) are created, blank both of these settings
define('TINYIB_ADMINPASS', '');       // 管理员的密码
define('TINYIB_MODPASS', '');         // 版主密码 ['' to disable]

// Database
//   Recommended database modes from best to worst:
//     pdo, mysqli, mysql, sqlite3, sqlite (deprecated), flatfile (only useful if you need portability or lack any kind of database)
define('TINYIB_DBMODE', 'flatfile');     // 数据存储方式,如mysql,sqlite等
//   Table names
//     Use the same table name across boards for global accounts, bans, etc.
define('TINYIB_DBACCOUNTS', 'accounts'); // Staff accounts
define('TINYIB_DBBANS', 'bans');         // Bans
define('TINYIB_DBKEYWORDS', 'keywords'); // Keywords
define('TINYIB_DBLOGS', 'logs');         // Staff logs
define('TINYIB_DBPOSTS', TINYIB_BOARD . '_posts');     // Posts
define('TINYIB_DBREPORTS', TINYIB_BOARD . '_reports'); // Reports
//   See README for migration instructions
define('TINYIB_DBMIGRATE', false);       // Enable database migration tool

// Database configuration - MySQL / pgSQL
//   The following only apply when TINYIB_DBMODE is set to mysql, mysqli or pdo with default (blank) TINYIB_DBDSN
define('TINYIB_DBHOST', 'localhost'); // Hostname
define('TINYIB_DBPORT', 3306);        // Port  (set to 0 if you are using a UNIX socket as the host)
define('TINYIB_DBUSERNAME', '');      // Username
define('TINYIB_DBPASSWORD', '');      // Password
define('TINYIB_DBNAME', '');          // Database

// Database configuration - SQLite / SQLite3
//   The following only apply when TINYIB_DBMODE is set to sqlite or sqlite3
define('TINYIB_DBPATH', '.tinyib.db');  // SQLite DB path

// Database configuration - PDO
//   The following only apply when TINYIB_DBMODE is set to pdo  (see README for instructions)
define('TINYIB_DBDRIVER', 'mysql');   // PDO driver to use (mysql / pgsql / sqlite / etc.)
define('TINYIB_DBDSN', '');           // Enter a custom DSN to override all of the connection/driver settings above  (see README for instructions)
//                                         When changing this, you should still set TINYIB_DBDRIVER appropriately.
//                                         If you're using PDO with a MySQL or pgSQL database, you should leave this blank.

后台管理地址

youdomain.com/imgboard.php?manage

注意每次修改完配置文件都需要进入后台执行rebuildall重新生成,否则配置不会生效。

官方代码仓库

https://code.rocketnine.space/tslocum/tinyib

💘 相关文章

写一条评论