############################################################## 
## MOD Title: Forum Weblogs
## MOD Author: hyperion < vinng86@hotmail.com > (Vincent Ng) N/A 
## MOD Description: Adds weblogs to your phpBB forums. They are user created and managed, and a group
##		    is automatically created for every weblog. Includes several user defineable fields
##		    and an ACP admin page.
##		   
## MOD Version: 0.4.0
## 
## Installation Level: Intermediate 
## Installation Time: 10 Minutes 
## Files To Edit: 9
##	includes/constants.php
##	includes/page_header.php
##	includes/page_tail.php
##	includes/functions_post.php
##	viewtopic.php
##	posting.php
##	admin/index.php
##	viewonline.php
##	templates/subSilver/overall_header.tpl
##	templates/subSilver/index_body.tpl
##	templates/subSilver/viewtopic_body.tpl
##	templates/subSilver/subSilver.cfg
##
## Included Files: 70
##	weblog.php
##	weblog2.php
##	weblog_config.php (aka myweblog.php)
##	weblog_db_update.php
##	weblog_entry.php
##	weblog_posting.php
##	weblog_rss.php
##	weblogs.php
##	admin/admin_weblog_categories.php
##	admin/admin_weblog_config.php
##	admin/admin_weblog_currently.php
##	admin/admin_weblog_edit.php
##	admin/admin_weblog_groups.php
##	admin/admin_weblog_management.php
##	admin/admin_weblog_mood.php
##	admin/admin_weblog_styles.php
##	images/xml.gif
##	images/weblogs/currently_custom.gif
##	images/weblogs/currently_eat.gif
##	images/weblogs/currently_listen.gif
##	images/weblogs/currently_none.gif
##	images/weblogs/currently_play.gif
##	images/weblogs/currently_read.gif
##	images/weblogs/currently_watch.gif
##	images/weblogs/currently_work.gif
##	images/weblogs/mood_amused.gif
##	images/weblogs/mood_angelic.gif
##	images/weblogs/mood_angry.gif
##	images/weblogs/mood_confused.gif
##	images/weblogs/mood_cool.gif
##	images/weblogs/mood_distorted.gif
##	images/weblogs/mood_embarrased.gif
##	images/weblogs/mood_evil.gif
##	images/weblogs/mood_fedup.gif
##	images/weblogs/mood_happy.gif
##	images/weblogs/mood_hypnotized.gif
##	images/weblogs/mood_love.gif
##	images/weblogs/mood_neutral.gif
##	images/weblogs/mood_none.gif
##	images/weblogs/mood_scared.gif
##	images/weblogs/mood_shocked.gif
##	images/weblogs/mood_sick.gif
##	images/weblogs/mood_silly.gif
##	images/weblogs/mood_sleepy.gif
##	images/weblogs/mood_verysad.gif
##	includes/functions_weblog.php
##	includes/weblogs_common.php
##	language/lang_english/lang_weblog_admin.php
##	language/lang_english/lang_weblog_main.php
##	templates/subSilver/weblog_config_body.tpl
##	templates/subSilver/weblog_entry_body.tpl
##	templates/subSilver/weblog_index_body.tpl
##	templates/subSilver/weblog_posting_body.tpl
##	templates/subSilver/admin/weblog_cats_body.tpl
##	templates/subSilver/admin/weblog_config_body.tpl
##	templates/subSilver/admin/weblog_currently_edit_body.tpl
##	templates/subSilver/admin/weblog_currently_list_body.tpl
##	templates/subSilver/admin/weblog_edit_body.tpl
##	templates/subSilver/admin/weblog_groups_body.tpl
##	templates/subSilver/admin/weblog_management_body.tpl
##	templates/subSilver/admin/weblog_mood_edit_body.tpl
##	templates/subSilver/admin/weblog_mood_list_body.tpl
##	templates/subSilver/admin/weblog_style_edit_body.tpl
##	templates/subSilver/admin/weblog_style_list_body.tpl
##	templates/subSilver/images/lang_english/entry.gif
##	templates/subSilver/images/lang_english/icon_weblog.gif
##	weblogs/code.htm
##	weblogs/code2.htm
##	weblogs/index.htm
##	weblogs/styles/index.htm
##
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
##	- Any modifications you made to viewtopic.php may also be applied to weblog_entry.php
##	- Any modifications you made to posting.php may also be applied to weblog_posting.php
##	- Any modifications you made to viewforum.php may also be applied to weblog2.php
##	   ----------------------------------------------------------------------------------------------------------------------------------
##	   o Any changes to submit_post() in posting.php (eg. as a result of another mod) MUST be made to submit_post() in weblog_posting.php
##		- Failure will result in an error message (Missing argument etc.)
##	   ----------------------------------------------------------------------------------------------------------------------------------
##	- When you are finished, check weblog_body.cfg and weblog_s_body.cfg in the weblog styles and uncomment parts
##	  that may require a mod. (remove the <!-- and --> to uncomment)
##
## PLEASE READ:
##	- You must have a directory called "weblogs" in the main PHPBB2 folder and it must be writable (CHMOD 666).
##	This is where the weblogs will be stored. This step is unneeded if you're running a Windows based server.
##	- A fully customizable HTML weblog means that there could be a security risk. For this reason,
##	please take caution in selecting whether or not users must be subscribed to a weblog. If that option is chosen,
##	the moderator of the weblog group dictates who can create a weblog.
##
## Installation Notes:
##	- Be careful when applying the changes, and always backup your existing files.
##	- You can try to use EasyMod to install this mod, however this method has not been tested yet.
##
############################################################## 
## MOD History: 
## 
##   2003-11-12 - Version 0.1.0 
##      - First BETA release of the Forum Weblogs code. Remember to backup existing files.
## 
##   2003-11-20 - Version 0.1.1 
##      - Fixed a few bugs.
##
##   2003-11-23 - Version 0.2.0 
##	- Removed "show profile", "show desc" etc. Replaced with full Weblog Page editing.
##	- Optimization of code.
##	- Code cleaned up.
##	- Weblog Stats added.
##	- Admin Management Added. Allows admin to edit/delete weblogs.
##	- Editable Weblog Face added.
##	- Pagination added.
##	- Sorting added.
##
##   2004-02-01 - Version 0.3.0
##	- Removed dependancy on fetchposts.php
##	- Added Admin Weblog Configuration
##	- Added Admin Weblog Management
##	- Added Configurable Mood and Currently Icons
##	- Added ability to show or hide the user's own weblog in Weblog Index
##	- Changed overall_header.tpl to make it easier to go to a user's own weblog
##	- Added ability for a weblog owner to designate topics as viewable only to certain user types 
##	   (All, Registered, Usergroup, Owner)
##
##   2004-02-29 - Version 0.3.0
##	- Added several improvements
##	- Added more features
##
##   2004-04-24 - Version 0.4.0
##	- Added option to reset weblog style (back to original unmodified state)
##	- Added weblog styles capability (removed template method)
##	- Added option to view a preview image (set by the admin) when a user selects a weblog style in weblog cp
##	- The name of the weblog system can be changed by editing three strings in weblog_main.php
##	- Changed weblog index look.
##	- Changed sorting algorithm of statistics
##	- Added "Last Seen" to weblog face - shows what the last "currently" was.
##	- Added Calendar to the weblog. Users can scroll back and forth in time. Days with entries are linked 
##	  to show that day's entries.
##	- Added "Go Back" and "Go Forward" - users can browse through the next <weblogs_per_page> or previous entries
##	- Added a new style to be included with package - simpleGray
##	- Added ability to set entries as "Memorable". These are viewable in the weblog entries page (the one that
##	  shows all entries in a list).
##	- Added ability to show the number of days old that a weblog is (on the weblog page).
##	- Added link in viewtopic.php that leads to a user's weblog (if they have one). An image is provided for subSilver.
##	- Fixed mood smilie problem not showing correct mood
##	- Fixed entry hidden options - wasn't working well before
##	- Fixed weblog index display order of weblog faces
##	- Added option for the admin whether or not all users must be subscribed to a weblog group
##	- Automatically detects the File Attachment Mod by Acyd Burn and enables support for it
##	- Now displays attachments in weblog.php, not just in weblog_entry.php
##	- Added an RSS feed script. To use, point to weblog_rss.php?w=(weblog_id).
##	- Added ability for a weblog owner to select the auth for replying. It may be set so that users can see the weblog,
##	  but cannot actually reply to the blog. It will complain if users are allowed to reply but not view the weblog!
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# SQL Queries 
#	These are the SQL commands that will change your database to accomodate the Forum Weblogs Mod. 
#	These have only been tested on MySQL 4.x.x, but they may also work on other dbms.
#
#	If you don't know how to run these SQL queries, or you don't use MySQL and don't want to try it,
# 	you can upload weblog_db_update.php, point your browser to it and it will run the SQL queries for you.
#	Don't forget to delete it after you run it. Leaving it there will create a potential security risk.

# 
#-----[ SQL ]------------------------------------------ 
# If you are using a different table prefix, replace "phpbb_" with your table preffix

CREATE TABLE phpbb_weblog_groups(group_id SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY(group_id));

CREATE TABLE phpbb_weblog_config(config_name VARCHAR (255) NOT NULL, config_value VARCHAR (255) NOT NULL, PRIMARY KEY(config_name));
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('config_id', '1');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('display_stats', '1');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('default_access', '0');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('default_entries', '5');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('default_name', '%s's Blog');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('default_desc', 'Welcome to my new blog!');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('default_comment', 'Comments: %s');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('default_post_comment', '(Post a comment)');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('weblogs_per_page', '10');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('weblog_sort', '1');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('weblog_order', 'desc');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('weblog_create', '1');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('allow_advanced', '0');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('birthday_mod', '0');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('birthday_zodiac_mod', '0');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('gender_mod', '0');
INSERT INTO phpbb_weblog_config(config_name, config_value) VALUES ('last_visit_mod', '0');

CREATE TABLE phpbb_weblog_mood(mood_id SMALLINT (5) UNSIGNED NOT NULL AUTO_INCREMENT, image_url VARCHAR (100), mood VARCHAR (75), PRIMARY KEY(mood_id));
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_none.gif', '(none)');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_angelic.gif', 'Angelic');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_confused.gif', 'Confused');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_cool.gif', 'Cool');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_silly.gif', 'Silly');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_verysad.gif', 'Very Sad');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_shocked.gif', 'Shocked');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_evil.gif', 'Evil');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_love.gif', 'In Love');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_amused.gif', 'Amused');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_angry.gif', 'Angry');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_neutral.gif', 'Neutral');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_sick.gif', 'Sick');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_scared.gif', 'Scared');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_happy.gif', 'Happy');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_fedup.gif', 'Fed Up With Life');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_distorted.gif', 'Distorted');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_hypnotized.gif', 'Hypnotized');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_embarrased.gif', 'Embarrased');
INSERT INTO phpbb_weblog_mood(image_url, mood) VALUES ('mood_sleepy.gif', 'Sleepy');

CREATE TABLE phpbb_weblog_currently(currently_id SMALLINT (5) UNSIGNED NOT NULL AUTO_INCREMENT, image_url VARCHAR (100), currently VARCHAR (75), PRIMARY KEY(currently_id));
INSERT INTO phpbb_weblog_currently(currently_id, image_url, currently) VALUES (1, 'currently_none.gif', '(none)');
INSERT INTO phpbb_weblog_currently(currently_id, image_url, currently) VALUES (2, 'currently_eat.gif', 'Eating');
INSERT INTO phpbb_weblog_currently(currently_id, image_url, currently) VALUES (3, 'currently_listen.gif', 'Listening to');
INSERT INTO phpbb_weblog_currently(currently_id, image_url, currently) VALUES (4, 'currently_play.gif', 'Playing');
INSERT INTO phpbb_weblog_currently(currently_id, image_url, currently) VALUES (5, 'currently_read.gif', 'Reading');
INSERT INTO phpbb_weblog_currently(currently_id, image_url, currently) VALUES (6, 'currently_watch.gif', 'Watching');
INSERT INTO phpbb_weblog_currently(currently_id, image_url, currently) VALUES (7, 'currently_work.gif', 'Working');
INSERT INTO phpbb_weblog_currently(currently_id, image_url, currently) VALUES (8, 'currently_custom.gif', '(custom)');

CREATE TABLE phpbb_weblog_styles(style_id SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT, style_name VARCHAR(100) NOT NULL, style_dir VARCHAR(100) NOT NULL, PRIMARY KEY(style_id));

ALTER TABLE phpbb_users ADD user_weblog SMALLINT(5);
ALTER TABLE phpbb_users ADD weblog_start_date INT(11) UNSIGNED;
ALTER TABLE phpbb_users ADD weblog_show_entries SMALLINT(5) UNSIGNED DEFAULT '5';
ALTER TABLE phpbb_users ADD weblog_access SMALLINT(5) DEFAULT '0';
ALTER TABLE phpbb_users ADD weblog_access2 SMALLINT(5) DEFAULT '0';
ALTER TABLE phpbb_users ADD weblog_visible TINYINT(1) DEFAULT '1';
ALTER TABLE phpbb_users ADD weblog_group SMALLINT(5) UNSIGNED DEFAULT '0';
ALTER TABLE phpbb_users ADD weblog_show_profile TINYINT(1) NOT NULL DEFAULT '1';
ALTER TABLE phpbb_users ADD weblog_show_desc TINYINT(1) NOT NULL DEFAULT '1';
ALTER TABLE phpbb_users ADD weblog_contact_info TINYINT(1) NOT NULL DEFAULT '1';
ALTER TABLE phpbb_users ADD weblog_show_info TINYINT(1) NOT NULL DEFAULT '1';
ALTER TABLE phpbb_users ADD weblog_advanced TINYINT(1) NOT NULL DEFAULT '0';
ALTER TABLE phpbb_users ADD weblog_post_comment_name VARCHAR(255) DEFAULT '(Post your comment)';
ALTER TABLE phpbb_users ADD weblog_comment_name VARCHAR(255) DEFAULT 'Comments: %s';
ALTER TABLE phpbb_users ADD weblog_style VARCHAR(30) DEFAULT '';
ALTER TABLE phpbb_users ADD INDEX(user_weblog);

ALTER TABLE phpbb_categories ADD cat_allow_weblogs TINYINT(1) UNSIGNED DEFAULT '0';
ALTER TABLE phpbb_topics ADD topic_mood TINYINT(2) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE phpbb_topics ADD topic_auth TINYINT(4) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE phpbb_topics ADD topic_currently1 TINYINT(2) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE phpbb_topics ADD topic_currently2 VARCHAR(100) NOT NULL DEFAULT '';
ALTER TABLE phpbb_posts ADD post_mood TINYINT(2) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE phpbb_posts ADD post_currently1 TINYINT(2) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE phpbb_posts ADD post_currently2 VARCHAR(100) NOT NULL DEFAULT '';
ALTER TABLE phpbb_forums ADD forum_views INT(11) UNSIGNED DEFAULT '0';

# 
#-----[ COPY ]------------------------------------------ 
# These are relative to the phpBB root (main) directory. Replace existing files if present.

weblog.php							to weblog.php
weblog2.php							to weblog2.php
weblog_config.php						to weblog_config.php
weblog_db_update.php						to weblog_db_update.php
weblog_entry.php						to weblog_entry.php
weblog_posting.php						to weblog_posting.php
weblog_rss.php							to weblog_rss.php
weblogs.php							to weblogs.php
admin/admin_weblog_categories.php				to admin/admin_weblog_categories.php
admin/admin_weblog_config.php					to admin/admin_weblog_config.php
admin/admin_weblog_currently.php				to admin/admin_weblog_currently.php
admin/admin_weblog_edit.php					to admin/admin_weblog_edit.php
admin/admin_weblog_groups.php					to admin/admin_weblog_groups.php
admin/admin_weblog_management.php				to admin/admin_weblog_management.php
admin/admin_weblog_mood.php					to admin/admin_weblog_mood.php
admin/admin_weblog_styles.php					to admin/admin_weblog_styles.php
images/xml.gif							to images/xml.gif
images/weblogs/currently_custom.gif				to images/weblogs/currently_custom.gif
images/weblogs/currently_eat.gif				to images/weblogs/currently_eat.gif
images/weblogs/currently_listen.gif				to images/weblogs/currently_listen.gif
images/weblogs/currently_none.gif				to images/weblogs/currently_none.gif
images/weblogs/currently_play.gif				to images/weblogs/currently_play.gif
images/weblogs/currently_read.gif				to images/weblogs/currently_read.gif
images/weblogs/currently_watch.gif				to images/weblogs/currently_watch.gif
images/weblogs/currently_work.gif				to images/weblogs/currently_work.gif
images/weblogs/mood_amused.gif					to images/weblogs/mood_amused.gif
images/weblogs/mood_angelic.gif					to images/weblogs/mood_angelic.gif
images/weblogs/mood_angry.gif					to images/weblogs/mood_angry.gif
images/weblogs/mood_confused.gif				to images/weblogs/mood_confused.gif
images/weblogs/mood_cool.gif					to images/weblogs/mood_cool.gif
images/weblogs/mood_distorted.gif				to images/weblogs/mood_distorted.gif
images/weblogs/mood_embarrased.gif				to images/weblogs/mood_embarrased.gif
images/weblogs/mood_evil.gif					to images/weblogs/mood_evil.gif
images/weblogs/mood_fedup.gif					to images/weblogs/mood_fedup.gif
images/weblogs/mood_happy.gif					to images/weblogs/mood_happy.gif
images/weblogs/mood_hypnotized.gif				to images/weblogs/mood_hypnotized.gif
images/weblogs/mood_love.gif					to images/weblogs/mood_love.gif
images/weblogs/mood_neutral.gif					to images/weblogs/mood_neutral.gif
images/weblogs/mood_none.gif					to images/weblogs/mood_none.gif
images/weblogs/mood_scared.gif					to images/weblogs/mood_scared.gif
images/weblogs/mood_shocked.gif					to images/weblogs/mood_shocked.gif
images/weblogs/mood_sick.gif					to images/weblogs/mood_sick.gif
images/weblogs/mood_silly.gif					to images/weblogs/mood_silly.gif
images/weblogs/mood_sleepy.gif					to images/weblogs/mood_sleepy.gif
images/weblogs/mood_verysad.gif					to images/weblogs/mood_verysad.gif
includes/functions_weblog.php					to includes/functions_weblog.php
includes/weblogs_common.php					to includes/weblogs_common.php
language/lang_english/lang_weblog_admin.php			to language/lang_english/lang_weblog_admin.php
language/lang_english/lang_weblog_main.php			to language/lang_english/lang_weblog_main.php
templates/subSilver/weblog_config_body.tpl			to templates/subSilver/weblog_config_body.tpl
templates/subSilver/weblog_entry_body.tpl			to templates/subSilver/weblog_entry_body.tpl
templates/subSilver/weblog_index_body.tpl			to templates/subSilver/weblog_index_body.tpl
templates/subSilver/weblog_posting_body.tpl			to templates/subSilver/weblog_posting_body.tpl
templates/subSilver/admin/weblog_cats_body.tpl			to templates/subSilver/admin/weblog_cats_body.tpl
templates/subSilver/admin/weblog_config_body.tpl		to templates/subSilver/admin/weblog_config_body.tpl
templates/subSilver/admin/weblog_currently_edit_body.tpl	to templates/subSilver/admin/weblog_currently_edit_body.tpl
templates/subSilver/admin/weblog_currently_list_body.tpl	to templates/subSilver/admin/weblog_currently_list_body.tpl
templates/subSilver/admin/weblog_edit_body.tpl			to templates/subSilver/admin/weblog_edit_body.tpl
templates/subSilver/admin/weblog_groups_body.tpl		to templates/subSilver/admin/weblog_groups_body.tpl
templates/subSilver/admin/weblog_management_body.tpl		to templates/subSilver/admin/weblog_management_body.tpl
templates/subSilver/admin/weblog_mood_edit_body.tpl		to templates/subSilver/admin/weblog_mood_edit_body.tpl
templates/subSilver/admin/weblog_mood_list_body.tpl		to templates/subSilver/admin/weblog_mood_list_body.tpl
templates/subSilver/admin/weblog_style_edit_body.tpl		to templates/subSilver/admin/weblog_style_edit_body.tpl
templates/subSilver/admin/weblog_style_list_body.tpl		to templates/subSilver/admin/weblog_style_list_body.tpl
weblogs/code.htm						to weblogs/code.htm
weblogs/code2.htm						to weblogs/code2.htm
weblogs/index.htm						to weblogs/index.htm
weblogs/styles/index.htm					to weblogs/styles/index.htm

# 
#-----[ OPEN ]------------------------------------------ 
# Make these changes to any phpBB file that has "prepare_post(" and "submit_post(" (only if you have other mods installed)
posting.php

# 
#-----[ FIND ]------------------------------------------ 
# 
prepare_post($mode, 

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
$subject, 

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
$currently1, $currently2, 

# 
#-----[ FIND ]------------------------------------------ 
# 
submit_post($mode, 

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
$poll_length

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
, $currently1, str_replace("\'", "''", $currently2), $entry_mood, $topic_auth

# 
#-----[ OPEN ]------------------------------------------ 
# 
viewtopic.php

# 
#-----[ FIND ]------------------------------------------ 
# This may be replace by u.* by other mods. In that case, skip these three steps
// Go ahead and pull all data for this topic
//
$sql = "SELECT u.username, u.user_id, 

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
 u.user_from,

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
 u.user_weblog,

# 
#-----[ FIND ]------------------------------------------ 
# 
		$yim_img = ( $postrow[$i]['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $postrow[$i]['user_yim'] . '&amp;.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
		$yim = ( $postrow[$i]['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $postrow[$i]['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
		$weblog_img = ( $postrow[$i]['user_weblog'] != 0 ) ? '<a href="' . append_sid("weblog.$phpEx?f=".$postrow[$i]['user_weblog']) . '"><img src="' . $images['icon_weblog'] . '" alt="' . $lang['Weblog'] . '" title="' . $lang['Weblog'] . '" border="0" /></a>' : '';
		$weblog = ( $postrow[$i]['user_weblog'] != 0 ) ? '<a href="' . append_sid("weblog.$phpEx?f=".$postrow[$i]['user_weblog']) . '">' . $lang['Weblog'] . '</a>' : '';

# 
#-----[ FIND ]------------------------------------------ 
# 
		$yim_img = '';
		$yim = '';

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
		$weblog_img = '';
		$weblog = '';

# 
#-----[ FIND ]------------------------------------------ 
# 
		'YIM_IMG' => $yim_img,
		'YIM' => $yim,

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
		'WEBLOG_IMG' => $weblog_img,
		'WEBLOG' => $weblog,

# 
#-----[ OPEN ]------------------------------------------ 
# 
viewonline.php

# 
#-----[ FIND ]------------------------------------------ 
# 
				case PAGE_FAQ:
					$location = $lang['Viewing_FAQ'];
					$location_url = "faq.$phpEx";
					break;

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
				case PAGE_WEBLOG:
					$location = $lang['Viewing_Weblog'];
					$location_url = "weblogs.$phpEx";
					break;
				case PAGE_WEBLOG2:
					$location = $lang['Viewing_Weblog2'];
					$location_url = "weblogs.$phpEx";
					break;
				case PAGE_WEBLOGS:
					$location = $lang['Viewing_Weblogs'];
					$location_url = "weblogs.$phpEx";
					break;
				case PAGE_WEBLOG_ENTRY:
					$location = $lang['Viewing_Weblog_entry'];
					$location_url = "weblogs.$phpEx";
					break;

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/constants.php    

# 
#-----[ FIND ]------------------------------------------ 
# 
define('PAGE_GROUPCP', -11);

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# Make sure that the last number on the end is unique.
define('PAGE_WEBLOG', -47);
define('PAGE_WEBLOG2', -48);
define('PAGE_WEBLOGS', -49);
define('PAGE_WEBLOG_ENTRY', -50);

# 
#-----[ FIND ]------------------------------------------ 
# 
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
define('WEBLOG_CONFIG_TABLE', $table_prefix.'weblog_config');
define('WEBLOG_CURRENTLY_TABLE', $table_prefix.'weblog_currently');
define('WEBLOG_GROUPS_TABLE', $table_prefix.'weblog_groups');
define('WEBLOG_MOOD_TABLE', $table_prefix.'weblog_mood');
define('WEBLOG_STYLE_TABLE', $table_prefix.'weblog_styles');

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/functions_post.php

# 
#-----[ FIND ]------------------------------------------ 
# 
function prepare_post(&$mode

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
&$subject, 

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
&$currently1, &$currently2, 

# 
#-----[ FIND ]------------------------------------------ 
# 
	// Check username
	if (!empty($username))
	{
		$username = trim(strip_tags($username));

		if (!$userdata['session_logged_in'] || ($userdata['session_logged_in'] && $username != $userdata['username']))
		{
			include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);

			$result = validate_username($username);
			if ($result['error'])
			{
				$error_msg .= (!empty($error_msg)) ? '<br />' . $result['error_msg'] : $result['error_msg'];
			}
		}
		else
		{
			$username = '';
		}
	}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	if (!empty($currently2))
	{
		$currently2 = htmlspecialchars(trim($currently2));
	}

# 
#-----[ FIND ]------------------------------------------ 
# 
function submit_post($mode

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
&$poll_length

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
, &$entry_currently1, &$entry_currently2, &$entry_mood, &$topic_auth

# 
#-----[ FIND ]------------------------------------------ 
# 
		$sql  = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title,

# 
#-----[ IN-LINE, FIND ]------------------------------------------ 
# 
topic_vote

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
, topic_currently1, topic_currently2, topic_mood, topic_auth

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
$topic_vote

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
, '$entry_currently1', '$entry_currently2', '$entry_mood', '$topic_auth'

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
topic_vote = " . $topic_vote : "") . "

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
, topic_currently1 = '$entry_currently1', topic_currently2 = '$entry_currently2', topic_mood = '$entry_mood', topic_auth = '$topic_auth'

# 
#-----[ FIND ]------------------------------------------ 
# 
	$sql = ($mode != "editpost") ? "INSERT INTO " . POSTS_TABLE . " (topic_id, 

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
, enable_sig

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
, post_mood, post_currently1, post_currently2

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
$attach_sig

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
, '$entry_mood', '$entry_currently1', '$entry_currently2'

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
enable_sig = $attach_sig

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
, post_currently1 = '$entry_currently1', post_currently2 = '$entry_currently2', post_mood = '$entry_mood'

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/page_header.php    

# 
#-----[ FIND ]------------------------------------------ 
#  
//
// Parse and show the overall header.
//

#
#-----[ BEFORE, ADD ]-----------------------------------
# Borrowed from the Today At Yesterday At Mod. If you have that mod installed then you don't have to do this.
//
// MOD - TODAY AT - BEGIN
// PARSE DATEFORMAT TO GET TIME FORMAT 
//
$time_reg = '([gh][[:punct:][:space:]]{1,2}[i][[:punct:][:space:]]{0,2}[a]?[[:punct:][:space:]]{0,2}[S]?)';
eregi($time_reg, $board_config['default_dateformat'], $regs);
$board_config['default_timeformat'] = $regs[1];
unset($time_reg);
unset($regs);

//
// GET THE TIME TODAY AND YESTERDAY
//
$today_ary = explode('|', create_date('m|d|Y', time(),$board_config['board_timezone']));
$board_config['time_today'] = gmmktime(0 - $board_config['board_timezone'] - $board_config['dstime'],0,0,$today_ary[0],$today_ary[1],$today_ary[2]);
$board_config['time_yesterday'] = $board_config['time_today'] - 86400;
unset($today_ary);
// MOD - TODAY AT - END

# 
#-----[ FIND ]------------------------------------------ 
# 
$template->set_filenames(array(
	'overall_header' => ( empty($gen_simple_header) ) ? 'overall_header.tpl' : 'simple_header.tpl')
);

# 
#-----[ BEFORE, ADD ]-----------------------------------
# 
if ( !defined('IN_WEBLOGS') )
{

# 
#-----[ AFTER, ADD ]-----------------------------------
# 
}

# 
#-----[ FIND ]------------------------------------------ 
# Partial Line
	$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level,

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# Partial Line
u.user_level,

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
 u.user_weblog,

# 
#-----[ FIND ]------------------------------------------ 
# 
				else if ( $row['user_level'] == MOD )

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
				else if ( $row['user_weblog'] != 0 )
				{
					$row['username'] = '<b>' . $row['username'] . '</b>';
					$style_color = 'style="color:#' . $theme['fontcolor1'] . '"';
				}

# 
#-----[ FIND ]------------------------------------------ 
# 
//
// The following assigns all _common_ variables that may be used at any point
// in a template.

# 
#-----[ BEFORE, ADD ]-----------------------------------
# 
// include the weblog lang file
$use_lang = ( !file_exists($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_weblog_main.'.$phpEx) ) ? 'english' : $board_config['default_lang'];
include_once($phpbb_root_path . 'language/lang_' . $use_lang . '/lang_weblog_main.' . $phpEx);

# 
#-----[ FIND ]------------------------------------------ 
# 
	'L_WHOSONLINE_MOD' => sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>'),

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
	'L_WHOSONLINE_WEBLOGGER' => sprintf($lang['Weblogger_online_color'], '<span style="color:#' . $theme['fontcolor1'] . '">', '</span>'),

	'L_WEBLOGS' => $lang['Weblog_Weblogs'],
	'L_WEBLOG_CONFIG' => $lang['Weblog_CP'],
	'L_MYWEBLOG' => $lang['Weblog_MyWeblog'],
        
	'U_WEBLOGS' => append_sid("weblogs.$phpEx"),
	'U_MYWEBLOG' => append_sid("weblog.$phpEx?f=".$userdata['user_weblog']),
	'U_WEBLOG_CONFIG' => append_sid("weblog_config.$phpEx"),

# 
#-----[ FIND ]------------------------------------------ 
# 
	if ( !empty($userdata['user_popup_pm']) )
	{
		$template->assign_block_vars('switch_enable_pm_popup', array());
	}
    
# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
	$sql_weblog = "SELECT * FROM " . USER_GROUP_TABLE . " g INNER JOIN " . WEBLOG_GROUPS_TABLE . " w ON w.group_id = g.group_id 
		WHERE g.user_id = " . $userdata['user_id'] . "
			AND g.user_pending <> 1";

	if( !($result_weblog = $db->sql_query($sql_weblog)) )
	{
		message_die(GENERAL_ERROR, 'Could not obtain weblog group information', '', __LINE__, __FILE__, $sql_weblog);
	}
	if ( $row_weblog = $db->sql_fetchrow($result_weblog) )
	{
		if ( $weblog_config['weblog_create'] == 0 || ( $userdata['user_level'] == ADMIN  && $weblog_config['weblog_create'] == 1 ) )
		{
			$template->assign_block_vars('switch_weblog_user', array());
		}
	}
	$db->sql_freeresult($result_weblog);

	if ( $userdata['user_weblog'] != 0 )
	{
		$template->assign_block_vars('switch_weblog_created', array());
	}

# 
#-----[ FIND ]------------------------------------------ 
# 
$template->pparse('overall_header');

# 
#-----[ BEFORE, ADD ]------------------------------------ 
# 
if ( !defined('IN_WEBLOGS') )
{

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
}

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/page_tail.php

# 
#-----[ FIND ]------------------------------------------ 
# 
$template->set_filenames(array(
	'overall_footer' => ( empty($gen_simple_header) ) ? 'overall_footer.tpl' : 'simple_footer.tpl')
);

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
if ( !defined('IN_WEBLOGS') )
{

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
}

# 
#-----[ FIND ]------------------------------------------ 
# 
$template->pparse('overall_footer');

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
if ( !defined('IN_WEBLOGS') )
{

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
}

# 
#-----[ OPEN ]------------------------------------------ 
#
includes/usercp_viewprofile.php

# 
#-----[ FIND ]------------------------------------------ 
#
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
$weblog_img = ( $profiledata['user_weblog'] != 0 ) ? '<a href="' . append_sid("weblog.$phpEx?w=".$profiledata['user_weblog']) . '"><img src="' . $images['icon_weblog'] . '" alt="' . $lang['Weblog'] . '" title="' . $lang['Weblog'] . '" border="0" /></a>' : '';
$weblog = ( $profiledata['user_weblog'] != 0 ) ? '<a href="' . append_sid("weblog.$phpEx?w=".$profiledata['user_weblog']) . '">' . $lang['Weblog'] . '</a>' : '';

# 
#-----[ FIND ]------------------------------------------ 
#
	'YIM_IMG' => $yim_img,
	'YIM' => $yim,

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	'WEBLOG_IMG' => $weblog_img,
	'WEBLOG' => $weblog,
	'L_WEBLOG' => $lang['Weblog'],

# 
#-----[ OPEN ]------------------------------------------ 
# 
admin/index.php

# 
#-----[ FIND ]------------------------------------------ 
# 
						case PAGE_FAQ:
							$location = $lang['Viewing_FAQ'];
							$location_url = "index.$phpEx?pane=right";
							break;

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
						case PAGE_WEBLOG:
							$location = $lang['Viewing_Weblog'];
							$location_url = "index.$phpEx?pane=right";
							break;
						case PAGE_WEBLOG2:
							$location = $lang['Viewing_Weblog2'];
							$location_url = "index.$phpEx?pane=right";
							break;
						case PAGE_WEBLOGS:
							$location = $lang['Viewing_Weblogs'];
							$location_url = "index.$phpEx?pane=right";
							break;
						case PAGE_WEBLOG_ENTRY:
							$location = $lang['Viewing_Weblog_entry'];
							$location_url = "index.$phpEx?pane=right";
							break;

# 
#-----[ FIND ]------------------------------------------ 
# 
					case PAGE_FAQ:
						$location = $lang['Viewing_FAQ'];
						$location_url = "index.$phpEx?pane=right";
						break;

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
					case PAGE_WEBLOG:
						$location = $lang['Viewing_Weblog'];
						$location_url = "index.$phpEx?pane=right";
						break;
					case PAGE_WEBLOG2:
						$location = $lang['Viewing_Weblog2'];
						$location_url = "index.$phpEx?pane=right";
						break;
					case PAGE_WEBLOGS:
						$location = $lang['Viewing_Weblogs'];
						$location_url = "index.$phpEx?pane=right";
						break;
					case PAGE_WEBLOG_ENTRY:
						$location = $lang['Viewing_Weblog_entry'];
						$location_url = "index.$phpEx?pane=right";
						break;

# 
#-----[ OPEN ]------------------------------------------ 
# Use these as a template for other templates that you might have.
templates/subSilver/overall_header.tpl


# 
#-----[ FIND ]------------------------------------------ 
# This line may be changed by other mods
					<tr>
						<td height="25" align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&nbsp;<a href="{U_PROFILE}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />{L_PROFILE}</a>&nbsp; &nbsp;<a href="{U_PRIVATEMSGS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_message.gif" width="12" height="13" border="0" alt="{PRIVATE_MESSAGE_INFO}" hspace="3" />{PRIVATE_MESSAGE_INFO}</a>&nbsp; &nbsp;<a href="{U_LOGIN_LOGOUT}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_login.gif" width="12" height="13" border="0" alt="{L_LOGIN_LOGOUT}" hspace="3" />{L_LOGIN_LOGOUT}</a>&nbsp;</span></td>
					</tr>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
					<tr>
						<td align="center" valign="top" nowrap="nowrap"><span class="mainmenu">
						<a href="{U_WEBLOGS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_message.gif" width="12" height="13" border="0" alt="{L_WEBLOGS}" hspace="3" />{L_WEBLOGS}</a>&nbsp; &nbsp;
   		    				<!-- BEGIN switch_weblog_user -->
						<a href="{U_WEBLOG_CONFIG}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_groups.gif" width="12" height="13" border="0" alt="{L_WEBLOG_CONFIG}" hspace="3" />{L_WEBLOG_CONFIG}</a>&nbsp;
   		    				<!-- END switch_weblog_user -->
   		    				<!-- BEGIN switch_weblog_user -->
						<a href="{U_MYWEBLOG}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="{L_MYWEBLOG}" hspace="3" />{L_MYWEBLOG}</a>&nbsp; &nbsp;
   		    				<!-- END switch_weblog_user -->
						</span></td>
					</tr>

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/index_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
	<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} &nbsp; [ {L_WHOSONLINE_ADMIN} ] &nbsp; [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>

# 
#-----[ IN-LINE, FIND ]------------------------------------------ 
# 
 &nbsp; [ {L_WHOSONLINE_MOD} ]

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
 &nbsp; [ {L_WHOSONLINE_WEBLOGGER} ]

# 
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/profile_view_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
#
		  //--></script><noscript>{ICQ_IMG}</noscript></td>
		</tr>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
		<tr> 
		  <td valign="middle" nowrap="nowrap" align="right"><span class="gen">{L_WEBLOG}:</span></td>
		  <td class="row1" valign="middle"><span class="gen">{WEBLOG_IMG}</span></td>
		</tr>

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/viewtopic_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
				<td valign="middle" nowrap="nowrap">{postrow.PROFILE_IMG} {postrow.PM_IMG} 

# 
#-----[ IN-LINE, FIND ]------------------------------------------ 
# 
{postrow.PM_IMG}

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
 {postrow.WEBLOG_IMG}

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/subSilver.cfg

# 
#-----[ FIND ]------------------------------------------ 
# 
?>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
$images['post_new_entry'] = "$current_template_images/{LANG}/entry.gif";
$images['icon_weblog'] = "$current_template_images/{LANG}/icon_weblog.gif";
   
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 


