blogconfig.php

Holds basic configuration constants that are required by all pages.  Some of these constants can be over-ridden in either the userdata/userconfig.php or userdata/userconfig.cfg files.  Those files do not exist in the default installation, but if created by the user, it will be executed before the body of this file.

Summary
Holds basic configuration constants that are required by all pages.
Directory name where user data is stored.
Path delimiter for local paths.
A globally accessible convenience function that takes a variable number of arguments and strings them together with PATH_DELIM.
A quick global function to define get the path to the current blog even if the BLOG_ROOT constant is not defined.
Loads a plugin.
Reads file contents, respecting the values of the LNBLOG_OPEN_BASEDIR and LNBLOG_PARANOIA configuration constants.
Tells the system what kind of URIs to generate.
The default language.
The language to use for text.
Directory to store the localization files.
Information on the package itself.
The official package name, currently “LnBlog”.
The version number of the software.
The full URL of the LnBlog project home page.
The offical text-blurb description of the software.
The offical LnBlog copyright notice.
These are full, valid doctypes to use for pages.
Full doctype for XHTML 1.1
Full doctype for XHTML 1.0 Strict
Full doctype for XHTML 1.0 Transitional
Full doctype for XHTML 1.0 Frameset
Full doctype for HTML 4.01 Strict
Full doctype for HTML 4.01 Transitional
Full doctype for HTML 4.01 Frameset
Full doctype for HTML 3.2
Assorted configuration constants that don’t fit into any coherent category.
Controls the use of PHP wrapper scripts for pages.
The DOCTYPE used by your markup.
The expiration time for the login cookies.
The default character encoding.
The default MIME type to accompany DEFAULT_CHARSET in the Content-Type.
Determine whether to use strftime() or date() for user-readable dates.
The character set used by the system when returning generated text.
This is the regular expression used to determine if a local path refers to a user’s web root, which would be referred to with a URI like http://www.example.com/~jowblow/ and vice versa.
The corresponding replacement pattern to LOCALPATH_TO_URI_MATCH_RE.
The reverse of LOCALPATH_TO_URI_MATCH_RE.
The corresponding replacement expression to URI_TO_LOCALPATH_MATCH_RE.
Use an ugly hack with htmlentities() instead of the simpler htmlspecialchars() to deal with problems displaying Unicode characters.
The file to save the sitemap link list for the menubar.
Defines the level of header used for the [h] LBCode tag.
Shows the inline boxes used for old version of the JavaScript editor
Shows the the buttons to add entities for mathamatical symbols.
Constants that relate to user authentication
Use sessions in authentication instead of just cookies.
Username of site administrator.
File name use to store custom fields that will be listed in user profiles.
The INI section of the CUSTOM_PROFILE file that holds the list of custom fields.
Configuration constants regarding date formats and file names.
File name for storing blog metadata.
Directory name used to store old blog settings.
The name of the subdirectory of the blog root URL under which blog entries are accessed.
Directory where draft entries are stored.
Like BLOG_ENTRY_PATH, except for static articles.
Like BLOG_ENTRY_PATH, except for accessing RSS feeds.
Default number of entries to display on the front page.
Controls whether deleted and modified entries are kept archived, or if they are just permanently deleted.
The date format used directories for blog entries.
An alternate to ENTRY_PATH_FORMAT.
The file name used to store the data for a blog enrty or article.
The character used to separate individual tags entered for entries.
Format used to display dates for entries and articles.
Directory name to access comments on entries and articles.
Directory name to access trackbacks on entries and articles.
Directory name to access pingbacks on entries and articles.
The file suffix for old versions of entries and articles.
The name of the “sticky” file for articles.
File suffix used for storing TrackBacks.
File suffix used for storing Pingbacks.
Configuration constants used for controlling reader comments.
Determine whether to use the rel=”nofollow” attribute in links in comments.
Like KEEP_EDIT_HISTORY, except for comments.
Default name for users who don’t enter a name.
Default text if the user does not enter a subject.
Date format string to use for comment file names.
File suffix to use for comment files.
Leaf directory name where deleted comments are stored.
Controls the default setting for whether e-mail addresses in comments are visible to everybody.

Essentials

Summary
Directory name where user data is stored.
Path delimiter for local paths.
A globally accessible convenience function that takes a variable number of arguments and strings them together with PATH_DELIM.
A quick global function to define get the path to the current blog even if the BLOG_ROOT constant is not defined.
Loads a plugin.
Reads file contents, respecting the values of the LNBLOG_OPEN_BASEDIR and LNBLOG_PARANOIA configuration constants.
Tells the system what kind of URIs to generate.
The default language.
The language to use for text.
Directory to store the localization files.

Constants

USER_DATA

Directory name where user data is stored.  The standard name is “userdata”.

PATH_DELIM

Path delimiter for local paths.  This is calculated at run-time and is set to ‘/’ for UNIX-like systems and ‘\’ for Windows systems.

Functions

mkpath

function mkpath()

A globally accessible convenience function that takes a variable number of arguments and strings them together with PATH_DELIM.

Returns

A string with each of the arguments separated by PATH_DELIM.

get_blog_path

function get_blog_path()

A quick global function to define get the path to the current blog even if the BLOG_ROOT constant is not defined.

Returns

The full path to the blog.

load_plugin

function load_plugin($plugin_name)

Loads a plugin.  This is used for plugins that do page output and will result in the plugin outputing its markup.  Note that not all plugins support this and for those that do, it is configurable as an option, with the alternative being using the event system.

Parameters

plugin_nameThe name of the class for this plugin.

Returns

An instance of the plugin.  The return value may safely be disregarded.

read_file

function read_file($filename)

Reads file contents, respecting the values of the LNBLOG_OPEN_BASEDIR and LNBLOG_PARANOIA configuration constants.

If LNBLOG_OPEN_BASEDIR and LNBLOG_PARANOIA are not defined or set to false, then this function behaves exactly like the standard file() function.

If LNBLOG_OPEN_BASEDIR is set, it will return false for any attempt to read a file that is above that directory in the filesystem.  So for example, if LNBLOG_OPEN_BASEDIR = /var/www/demo, then this will return the contents of /var/www/demo/file.txt or /var/www/demo/foo/bar.txt, but it will return false for /var/www/myfile.txt

If LNBLOG_PARANOIA is set, this will return false when attempting to open any file with a .php extension.  So, for example, it would open /var/www/demo/foo.txt, but would return false for /var/www/demo/foo.php.

Constants

URI_TYPE

Tells the system what kind of URIs to generate.  The available values are as follows. directory - Convert local directory paths directly into URIs using the old wrapper script method. querystring - Use ugly old query string URIs. htaccess - Use query strings made pretty with Apache rewrite rules.  Note that this only works on Apache servers with support for mod_rewrite and .htaccess files.  The default mode is “directory”.

DEFAULT_LANGUAGE

The default language.  If a translation does not exist for your specified language, then this will be used as the “last resort.”  This is set to “en_US”.

LANGUAGE

The language to use for text.  This setting controls which language is used for the templates and other literal text that LnBlog outputs.

The default is to use the value of the LANG environment variable, if it is set.  If not, this is set to the DEFAULT_LANGUAGE and the LANG environment variable is set.

Please note that this constant is also used to set the locale, as follows.

setlocale(LC_ALL, LANGUAGE);

Because of this, it is important to note that Windows uses different values for languages than UNIX and Linux systems.  In Linux, for example, a German locale might be “de_DE”, whereas on Windows it woule be “deu”.

LOCALEDIR

Directory to store the localization files.  This is used by both GNU gettext and the ad hoc translation system.

Package information

Information on the package itself.

Summary
The official package name, currently “LnBlog”.
The version number of the software.
The full URL of the LnBlog project home page.
The offical text-blurb description of the software.
The offical LnBlog copyright notice.

Constants

PACKAGE_NAME

The official package name, currently “LnBlog”.

PACKAGE_VERSION

The version number of the software.  This is a string in the format “1.2.3”.  Note that each number may be more than one digit.

PACKAGE_URL

The full URL of the LnBlog project home page.

PACKAGE_DESCRIPTION

The offical text-blurb description of the software.

PACKAGE_COPYRIGHT

The offical LnBlog copyright notice.

Page DOCTYPEs

These are full, valid doctypes to use for pages.  See DEFAULT_DOCTYPE.

Summary
Full doctype for XHTML 1.1
Full doctype for XHTML 1.0 Strict
Full doctype for XHTML 1.0 Transitional
Full doctype for XHTML 1.0 Frameset
Full doctype for HTML 4.01 Strict
Full doctype for HTML 4.01 Transitional
Full doctype for HTML 4.01 Frameset
Full doctype for HTML 3.2

Constants

XHTML_1_1

Full doctype for XHTML 1.1

XHTML_1_0_Strict

Full doctype for XHTML 1.0 Strict

XHTML_1_0_Transitional

Full doctype for XHTML 1.0 Transitional

XHTML_1_0_Frameset

Full doctype for XHTML 1.0 Frameset

HTML_4_01_Strict

Full doctype for HTML 4.01 Strict

HTML_4_01_Transitional

Full doctype for HTML 4.01 Transitional

HTML_4_01_Frameset

Full doctype for HTML 4.01 Frameset

HTML_3_2

Full doctype for HTML 3.2

Miscellaneous configuration

Assorted configuration constants that don’t fit into any coherent category.

Summary
Controls the use of PHP wrapper scripts for pages.
The DOCTYPE used by your markup.
The expiration time for the login cookies.
The default character encoding.
The default MIME type to accompany DEFAULT_CHARSET in the Content-Type.
Determine whether to use strftime() or date() for user-readable dates.
The character set used by the system when returning generated text.
This is the regular expression used to determine if a local path refers to a user’s web root, which would be referred to with a URI like http://www.example.com/~jowblow/ and vice versa.
The corresponding replacement pattern to LOCALPATH_TO_URI_MATCH_RE.
The reverse of LOCALPATH_TO_URI_MATCH_RE.
The corresponding replacement expression to URI_TO_LOCALPATH_MATCH_RE.
Use an ugly hack with htmlentities() instead of the simpler htmlspecialchars() to deal with problems displaying Unicode characters.
The file to save the sitemap link list for the menubar.
Defines the level of header used for the [h] LBCode tag.
Shows the inline boxes used for old version of the JavaScript editor
Shows the the buttons to add entities for mathamatical symbols.

Constants

USE_WRAPPER_SCRIPTS

Controls the use of PHP wrapper scripts for pages.  When this is turned on, LnBlog will use a series of wrapper PHP scripts to include the files that build pages.  This results in a clean, directory-based URL structure.

If this is set to false, then LnBlog will revert to a URL scheme based on query strings.  The up side of doing things this way is that you never need to upgrade the wrapper scripts.  You can achieve a clean URL structure this way if you have Apache and an appropriate .htacces file.

Defaults to true.  Note: this is not yet implemented.

DEFAULT_DOCTYPE

The DOCTYPE used by your markup.

The default is XHTML 1.0 Strict.

LOGIN_EXPIRE_TIME

The expiration time for the login cookies.

If set to an integer value, the cookies used for user logins will expire that number of seconds from the current time.  So, if you set this to 3600, then the user will be logged out in 1 hour.

The default is false, which means cookies expire when the session ends.

DEFAULT_CHARSET

The default character encoding.  This is the encoding included in the Content-Type meta tag for each page.

There are two defaults for this setting.  If the default_charset INI variable is set, then that value is used.  If it is not set, then the default is to use “utf-8”, which is an ASCII-compatible Unicode encoding.

DEFAULT_MIME_TYPE

The default MIME type to accompany DEFAULT_CHARSET in the Content-Type.

As with DEFAULT_CHARSET, there are two possible defaults for this.  If the default_mimetype INI variable is set, then that value is used.  If it is not, then the default is “text/html”.

USE_STRFTIME

Determine whether to use strftime() or date() for user-readable dates.

Defaults to true.  When set to false, things like entry dates will be formatted using the function date() instead of strftime().  If you change this, you will also need to change the ENTRY_DATE_FORMAT.

SYSTEM_CHARSET

The character set used by the system when returning generated text.

This is used in conjunction with USE_STRFTIME to automatically convert characters.  By default, this is not set.  When it is set and the iconv extension is enabled, then the dates will be converted from this character set to the DEFAULT_CHARSET.

LOCALPATH_TO_URI_MATCH_RE

This is the regular expression used to determine if a local path refers to a user’s web root, which would be referred to with a URI like http://www.example.com/~jowblow/ and vice versa.  The generated URI will use the parent of the document root, e.g.  /home/users/joeblow/www/ would be translated to /~joeblow/.  Depending on your setup, you may need to add components before the username or change the document root from www to something else.  Of course, if you don’t use ~user directories, you can probably ignore this.

Default is “/^\/home\/([^\/]+)\/www(.*)/i”.

LOCALPATH_TO_URI_REPLACE_RE

The corresponding replacement pattern to LOCALPATH_TO_URI_MATCH_RE.

Default is “/~$1$2”.

URI_TO_LOCALPATH_MATCH_RE

The reverse of LOCALPATH_TO_URI_MATCH_RE.  This is the regular expression that matches part of a root-relative URI and extracts a directory name.

Default is “/^\/~([^\/]+)(.*)/i”.

URI_TO_LOCALPATH_REPLACE_RE

The corresponding replacement expression to URI_TO_LOCALPATH_MATCH_RE.

Default is “$2”.

UNICODE_ESCAPE_HACK

Use an ugly hack with htmlentities() instead of the simpler htmlspecialchars() to deal with problems displaying Unicode characters.

This is to account for character encoding issues.  The basic situation is that, for whatever reason, it appears that if the many browsers will automatically escape characters in the wrong encoding to numeric HTML character codes.  When sanitizing this input with htmlentities(), the ampersands get converted to & and so need to be converted back.  When this is set to true, that’s what happens.

When this is set to false, input will only be sanitized with htmlspecialchars(), which does fewer substitutions in the first place.  This mode does not effect the above mentioned auto-conversion, so you should only use this if you’re sure nobody is going to be posting to the site in a character set that differs from the one defined by the server.

Note that this setting only applies to posts (including comments) that use LBCode or auto-markup.  Raw HTML code is left completely unmodified.

Default is true.

SITEMAP_FILE

The file to save the sitemap link list for the menubar.

Default is “sitemap.htm”.

LBCODE_HEADER_WEIGHT

Defines the level of header used for the [h] LBCode tag.

Default is 3.

EDITOR_HIDE_INLINE_BOXES

Shows the inline boxes used for old version of the JavaScript editor

Default is false.

EDITOR_HIDE_SYMBOLS

Shows the the buttons to add entities for mathamatical symbols.

Default is false.

User Authentication

Constants that relate to user authentication

Summary
Use sessions in authentication instead of just cookies.
Username of site administrator.
File name use to store custom fields that will be listed in user profiles.
The INI section of the CUSTOM_PROFILE file that holds the list of custom fields.

Constants

AUTH_USE_SESSION

Use sessions in authentication instead of just cookies.

Default is true.

ADMIN_USER

Username of site administrator.  This is the only one who can add or delete blogs.

Default is “administrator”.

CUSTOM_PROFILE

File name use to store custom fields that will be listed in user profiles.  This file is in INI format, with key names corresponding to the custom field names and values being the label displayed for the field.

CUSTOM_PROFILE_SECTION

The INI section of the CUSTOM_PROFILE file that holds the list of custom fields.

Blog configuration

Configuration constants regarding date formats and file names.

Summary
File name for storing blog metadata.
Directory name used to store old blog settings.
The name of the subdirectory of the blog root URL under which blog entries are accessed.
Directory where draft entries are stored.
Like BLOG_ENTRY_PATH, except for static articles.
Like BLOG_ENTRY_PATH, except for accessing RSS feeds.
Default number of entries to display on the front page.

Constants

BLOG_CONFIG_PATH

File name for storing blog metadata.  Note that this is specific to file-based storage and should not be used for database storage.

Default is “blogdata.ini”.

BLOG_DELETED_PATH

Directory name used to store old blog settings.  Note that this is only for file-based storage that uses history-tracking.

Default is “deleted”.

BLOG_ENTRY_PATH

The name of the subdirectory of the blog root URL under which blog entries are accessed.  This may not necessarily be a real directory on the server.

Default is “entries”.

ENTRY_DRAFT_PATH

Directory where draft entries are stored.

Default is “drafts”.

BLOG_ARTICLE_PATH

Like BLOG_ENTRY_PATH, except for static articles.

Default is “content”.

BLOG_RSS_PATH

Like BLOG_ENTRY_PATH, except for accessing RSS feeds.

Default is “feeds”.

BLOG_MAX_ENTRIES

Default number of entries to display on the front page.

This constant is used as a default setting for creating new blogs and can be over-ridden on a per-blog basis.  In other words, not every blog will use this value.

Default is 10.

Blog entry and Article configuration

Summary
Controls whether deleted and modified entries are kept archived, or if they are just permanently deleted.
The date format used directories for blog entries.
An alternate to ENTRY_PATH_FORMAT.
The file name used to store the data for a blog enrty or article.
The character used to separate individual tags entered for entries.
Format used to display dates for entries and articles.
Directory name to access comments on entries and articles.
Directory name to access trackbacks on entries and articles.
Directory name to access pingbacks on entries and articles.
The file suffix for old versions of entries and articles.
The name of the “sticky” file for articles.

Constants

KEEP_EDIT_HISTORY

Controls whether deleted and modified entries are kept archived, or if they are just permanently deleted.

The default is false, which mean that deleted items are gone forever.  In previous versions, the default behavior was to save these, despite the fact that there was no interface for dealing with them.

ENTRY_PATH_FORMAT

The date format used directories for blog entries.

The formats here are passed to the PHP strftime(), so check the docs on that for details.  The creation timestamp of the blog entry is used to return the exact value.

Programmers should also note that the “directories” referenced here are components of a URI and may not be real directories on the server.

The default is “d_Hi”, which is the day, hour, and minute.  For example, 10_1215 would be returned for 12:15 PM on the 10th of the month.

ENTRY_PATH_FORMAT_LONG

An alternate to ENTRY_PATH_FORMAT.

This format was used in earlier versions of the software, but is retained in case there is a need to fall back to a longer format.

The default is “d_His”, which is the same as ENTRY_PATH_FORMAT, but includes the seconds at the end.

ENTRY_DEFAULT_FILE

The file name used to store the data for a blog enrty or article.  Note that this is specific to file-based storage.

The default is “current.htm”.

TAG_SEPARATOR

The character used to separate individual tags entered for entries.

The default is a comma (“,”).

ENTRY_DATE_FORMAT

Format used to display dates for entries and articles.  Note that, like ENTRY_PATH_FORMAT this string includes strftime() scancodes.

The default is “%Y-%m-%d %H:%M %Z”, which gives a date like “2005-08-16 04:26 EST”.

ENTRY_COMMENT_DIR

Directory name to access comments on entries and articles.

Default is “comments”.

ENTRY_TRACKBACK_DIR

Directory name to access trackbacks on entries and articles.

Default is “trackback”.

ENTRY_PINGBACK_DIR

Directory name to access pingbacks on entries and articles.

Default is “pingback”.

ENTRY_PATH_SUFFIX

The file suffix for old versions of entries and articles.  Note that this only applies to file-based storage when using history tracking.

The default is “.htm”.

STICKY_PATH

The name of the “sticky” file for articles.

In the file-based storage implementation, when this file exists in an article directory, the article will be treated as “sticky,” meaning it will be displayed in the default sidebar.  This file may contain some of the article metadata.  The exact content is intentionally left undocumented, but will include at least the subject.

The default value is “sticky.txt”.

Trackback configuration

Summary
File suffix used for storing TrackBacks.

Constants

TRACKBACK_PATH_SUFFIX

File suffix used for storing TrackBacks.  Note that this is specific to file-based storage.

The default is “.txt”.

Pingback configuration

Summary
File suffix used for storing Pingbacks.

Constants

PINGBACK_PATH_SUFFIX

File suffix used for storing Pingbacks.  Note that this is specific to file-based storage.

The default is “.txt”.

Comment configuration

Configuration constants used for controlling reader comments.

Summary
Determine whether to use the rel=”nofollow” attribute in links in comments.
Like KEEP_EDIT_HISTORY, except for comments.
Default name for users who don’t enter a name.
Default text if the user does not enter a subject.
Date format string to use for comment file names.
File suffix to use for comment files.
Leaf directory name where deleted comments are stored.
Controls the default setting for whether e-mail addresses in comments are visible to everybody.

Constants

COMMENT_NOFOLLOW

Determine whether to use the rel=”nofollow” attribute in links in comments.  This attribute is a comment spam fighting measure instituted by Google, who will not index links with this attribute.

Default is true.

KEEP_COMMENT_HISTORY

Like KEEP_EDIT_HISTORY, except for comments.

Default is false Again, this was previously on my default, but is now off.

ANON_POST_NAME

Default name for users who don’t enter a name.

Default is “Anonymous Reader”.

NO_SUBJECT

Default text if the user does not enter a subject.

Default is “No Subject”.

COMMENT_PATH_FORMAT

Date format string to use for comment file names.

The default is “Y-m-d_His”.

COMMENT_PATH_SUFFIX

File suffix to use for comment files.

Default is “.txt”.

COMMENT_DELETED_PATH

Leaf directory name where deleted comments are stored.

The default is “deleted”.

COMMENT_EMAIL_VIEW_PUBLIC

Controls the default setting for whether e-mail addresses in comments are visible to everybody.

The default is false, which means only logged-in users can see e-mail addresses specified as non-public.

function mkpath()
A globally accessible convenience function that takes a variable number of arguments and strings them together with PATH_DELIM.
function get_blog_path()
A quick global function to define get the path to the current blog even if the BLOG_ROOT constant is not defined.
function load_plugin($plugin_name)
Loads a plugin.
function read_file($filename)
Reads file contents, respecting the values of the LNBLOG_OPEN_BASEDIR and LNBLOG_PARANOIA configuration constants.
The default character encoding.
This is the regular expression used to determine if a local path refers to a user’s web root, which would be referred to with a URI like http://www.example.com/~jowblow/ and vice versa.
The reverse of LOCALPATH_TO_URI_MATCH_RE.
File name use to store custom fields that will be listed in user profiles.
The name of the subdirectory of the blog root URL under which blog entries are accessed.
The date format used directories for blog entries.
Controls whether deleted and modified entries are kept archived, or if they are just permanently deleted.
The default language.
The DOCTYPE used by your markup.
Format used to display dates for entries and articles.
Determine whether to use strftime() or date() for user-readable dates.