资源说明:Simple CGI blog
Fusion ====== Blogging software written in C++ and designed to be run as a CGI application. It's overly complicated for a task that static files could better serve but it was created out of boredom and curiosity. Uses a PostgreSQL backend to store posts and comments. Application can serve quite a lot of requests per second but the database backend is the bottleneck. Using flatfiles or memcached would greatly speed things up even more. Internationalization is available through gettext. Detects the user's accepted languages through HTTP_ACCEPT_LANGUAGE set by the browser. If the user accepts Japanese then Fusion will set the locale to Japanese; otherwise it defaults to English. Other locals could be easily added if desired. Uses "blog" as the package name to find LC_MESSAGES. Separate admin section available to create posts and maintain comments. Also contains an RSS feed to the posts. Includes comment rate limiting. Originally created around November of 2005. Ran in production for nearly a year before project was scrapped. A more robust Makefile is sorely needed to set the locale package name, database DSN and other hard coded values at runtime. Requirements ------------ * [libpqxx](http://pqxx.org/development/libpqxx/) for PostgreSQL interface. Tested again version 2.4.1. Setup ----- Fusion needs its own database. Change "fusion_user" to whatever user you have created that you want to use. ```sql \set db_user 'fusion_user' CREATE SEQUENCE blog_entry_id; COMMENT ON SEQUENCE blog_entry_id IS 'A unique identifier for each entry.'; GRANT ALL PRIVILEGES ON blog_entry_id TO :db_user ; CREATE SEQUENCE blog_comment_id; COMMENT ON SEQUENCE blog_comment_id IS 'A unique identifier for each blog comment.'; GRANT ALL PRIVILEGES ON blog_comment_id TO :db_user ; CREATE TABLE blog_entry ( id INTEGER NOT NULL DEFAULT nextval('blog_entry_id'), posttime INTEGER NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW())::bigint, updatetime INTEGER NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW())::bigint, ip INET NOT NULL, body TEXT NOT NULL, title VARCHAR(255) NOT NULL, allow_comments BOOLEAN NOT NULL DEFAULT TRUE ); COMMENT ON TABLE blog_entry IS 'Every entry\'s attributes and details.'; GRANT DELETE, INSERT, SELECT, UPDATE ON blog_entry TO :db_user ; CREATE INDEX blog_entry_idx1 ON blog_entry USING BTREE (posttime); CREATE TABLE blog_comment ( id INTEGER NOT NULL DEFAULT nextval('blog_comment_id'), blog_id INTEGER NOT NULL, posttime INTEGER NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW())::bigint, ip INET NOT NULL, name VARCHAR(25) NOT NULL, email VARCHAR(120), homepage VARCHAR(256), body TEXT NOT NULL, CONSTRAINT blog_comment_pkey PRIMARY KEY (id, blog_id) ); COMMENT ON TABLE blog_comment IS 'Comments for entries.'; GRANT DELETE, INSERT, SELECT, UPDATE ON blog_comment TO :db_user ; CREATE TABLE blog_attributes ( -- Old schema running under C++ -- blog_name VARCHAR(45) NOT NULL, -- profile_location VARCHAR(256), -- profile_comment TEXT name VARCHAR(64) NOT NULL, value VARCHAR(256), CONSTRAINT blog_attributes_pkey PRIMARY KEY (name) ); COMMENT ON TABLE blog_attributes IS 'Blog settings and attributes.'; GRANT DELETE, SELECT, UPDATE ON blog_attributes TO :db_user ; ``` In `common.h`, change `db_dsn` to match the DSN to your database and change `base_url` to the base URL of the blog. The administration page is a separate compile. Change directory in the `admin` subdirectory to compile the page. The binary does not have to reside in this subdirectory in production. The page does not provide any sort of protection so either obscure its location, protect it with `htpasswd` or by IP with `.htaccess`.
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。