#################################################################
## MOD Title: File Attachment Mod v2
## MOD Author: Acyd Burn < N/A > (Meik Sievertsen) http://www.opentools.de/
## MOD Description:
## This Mod adds the ability to attach files in phpBB2.
## This Version has been tested and works with phpBB 2.0.19.
## This Version will NOT work with phpBB2 Modules designed for *Nuke Portals or phpBB2 Ports.
## MOD Version: 2.4.1
##
## Installation Level: Intermediate
## Installation Time: 30-60 Minutes
## Files To Edit (30): common.php, faq.php, modcp.php, posting.php, privmsg.php,
## viewforum.php, viewtopic.php, admin/admin_forumauth.php, admin/admin_ug_auth.php, admin/admin_forums.php,
## admin/admin_groups.php, admin/admin_users.php, includes/auth.php, includes/functions.php, includes/functions_admin.php,
## includes/prune.php, includes/topic_review.php, includes/usercp_viewprofile.php, modcp_body.tpl, posting_body.tpl,
## posting_preview.tpl, posting_topic_review.tpl, privmsgs_body.tpl, privmsgs_preview.tpl, privmsgs_read_body.tpl,
## profile_view_body.tpl, viewforum_body.tpl, viewtopic_body.tpl, admin/group_edit_body.tpl, admin/user_edit_body.tpl
## Lines(!) To Add: 115
## Included Files: many many files
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## Complete feature list: docs/features.txt
## The user guide: docs/user_guide.html
##
## Some tips:
## - I suggest reading the user guide first if you haven't installed any Mods before.
## - Please note that this Mod is NOT written to be EasyMod compatible (i haven't tested it).
## - Please follow the installation instructions as strict as you can.
##
##
## UPDATING/UPGRADING:
##
## Please skip to the NEW INSTALLATION part if you want to install the
## attachment mod for the first time or want to setup a new installation.
##
## Please read the docs/update.txt document for update/upgrade instructions.
##
##
## NEW INSTALLATION:
##
## You are able to choose between two installation types, depending on your setup:
##
## -> Using the pre-modified files:
##
## This method is recommended for those having a vanilla (plain, not modded) phpBB Installation.
## With this method you do not need to adjust your phpBB files at all, only running the installer
## and uploading all files - including the pre-modified files - is required.
##
## If you think this is the correct method for you, please follow the following steps listet in:
## docs/install_using_premod_files.txt
## to install the attachment mod.
##
## BTW, it is save to close this file now if you use this method. ;)
##
##
##
## -> Using the mod instructions:
##
## This method is recommended for those already having applied mods to their phpBB Installation.
##
## If you think this is the correct method for you, please read further.
##
##
##
## Credits:
## Thanks to all people translating this Mod into their language and offering their work.
## Also a big thank you to those supporting this Mod and offering help to those having problems.
##
##
## The following sites also contain the latest version of this MOD:
##
## http://www.opentools.de/
## http://sourceforge.net/projects/acydmods
## http://www.phpbb.com/mods
##
## Full support for this MOD can be obtained at:
## http://www.opentools.de/
## Please Note that i am not able to contribute to the Attachment Mod topic at phpbb.com (http://www.phpbb.com/phpBB/viewtopic.php?t=74505)
##
##############################################################
## MOD History:
##
## 2005-12-30 - Version 2.4.1
## - fixed doubled sql_freeresult in functions_selects.php
## - fix extension admin panel (unable to update extensions)
## - changed tmp dir for ftp download in safe mod from temp directory in upload directory to upload directory
##
## 2005-11-24 - Version 2.4.0a
## - fixed a call to sql_build_array (wrong function used) in attach_mod/includes/functions_admin.php
## this is producing a php error message within the user administration panel (editing user details)
## - this version is a repackage, therefore the "a" at the end (nothing else changed, update path and everything else is the same)
##
## 2005-11-21 - Version 2.4.0
## - using olympus' system of retrieving and storing values
## - using function for sql escaping
## - installer now checks for upload directory
## - fixing multiple call to database in installer
## - fixing sort_multi_array to correctly decide if sorting is based on numeric or string
## - taking open basedir restriction into account if checking for image size
## - making creation of temporary thumbnail file more unique if ftp upload is used (thanks to Douglas Hoffman)
## - fixing viewing of no longer viewable/denied attachments for admins (alcaeus)
## - display correct filename on download
## - added optional language variables (Sync_topics, Sync_posts and Sync_thumbnails)
##
## Please read the docs/changelog.txt document for a complete changelog.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
# Here starts the Installation, follow the steps very closely.
#
#
# STEP NUMBER I: Uploading all new Files
#
# Copy/Upload all files to their respective Location
# The left side shows the location of the file you should have after decompressing the package,
# the right side shows the location the file must be copied to, it is always the phpBB Root path (where the config.php file is stored at).
# Alternatively just decompress/upload the contents within the attachment_mod folder directly to your phpBB folder.
#
# attachment_mod/download.php -> download.php
# attachment_mod/uacp.php -> uacp.php
# attachment_mod/attach_rules.php -> attach_rules.php
# attachment_mod/admin/admin_attach_cp.php -> admin/admin_attach_cp.php
# attachment_mod/admin/admin_attachments.php -> admin/admin_attachments.php
# attachment_mod/admin/admin_extensions.php -> admin/admin_extensions.php
# attachment_mod/attach_mod/attachment_mod.php -> attach_mod/attachment_mod.php
# attachment_mod/attach_mod/displaying.php -> attach_mod/displaying.php
# attachment_mod/attach_mod/index.htm -> attach_mod/index.htm
# attachment_mod/attach_mod/pm_attachments.php -> attach_mod/pm_attachments.php
# attachment_mod/attach_mod/posting_attachments.php -> attach_mod/posting_attachments.php
# attachment_mod/attach_mod/includes/constants.php -> attach_mod/includes/constants.php
# attachment_mod/attach_mod/includes/functions_admin.php -> attach_mod/includes/functions_admin.php
# attachment_mod/attach_mod/includes/functions_attach.php -> attach_mod/includes/functions_attach.php
# attachment_mod/attach_mod/includes/functions_delete.php -> attach_mod/includes/functions_delete.php
# attachment_mod/attach_mod/includes/functions_filetypes.php -> attach_mod/includes/functions_filetypes.php
# attachment_mod/attach_mod/includes/functions_includes.php -> attach_mod/includes/functions_includes.php
# attachment_mod/attach_mod/includes/functions_selects.php -> attach_mod/includes/functions_selects.php
# attachment_mod/attach_mod/includes/functions_thumbs.php -> attach_mod/includes/functions_thumbs.php
# attachment_mod/attach_mod/includes/index.htm -> attach_mod/includes/index.htm
# attachment_mod/files/index.php -> files/index.php
# attachment_mod/images/icon_clip.gif -> images/icon_clip.gif
# attachment_mod/images/icon_disk.gif -> images/icon_disk.gif
# attachment_mod/images/icon_disk_gray.gif -> images/icon_disk_gray.gif
# attachment_mod/templates/subSilver/add_attachment_body.tpl -> templates/subSilver/add_attachment_body.tpl
# attachment_mod/templates/subSilver/posted_attachments_body.tpl -> templates/subSilver/posted_attachments_body.tpl
# attachment_mod/templates/subSilver/posting_attach_body.tpl -> templates/subSilver/posting_attach_body.tpl
# attachment_mod/templates/subSilver/posting_attach_rules.tpl -> templates/subSilver/posting_attach_rules.tpl
# attachment_mod/templates/subSilver/uacp_body.tpl -> templates/subSilver/uacp_body.tpl
# attachment_mod/templates/subSilver/viewtopic_attach_body.tpl -> templates/subSilver/viewtopic_attach_body.tpl
# attachment_mod/templates/subSilver/admin/attach_cat_body.tpl -> templates/subSilver/admin/attach_cat_body.tpl
# attachment_mod/templates/subSilver/admin/attach_cp_attachments.tpl -> templates/subSilver/admin/attach_cp_attachments.tpl
# attachment_mod/templates/subSilver/admin/attach_cp_body.tpl -> templates/subSilver/admin/attach_cp_body.tpl
# attachment_mod/templates/subSilver/admin/attach_cp_search.tpl -> templates/subSilver/admin/attach_cp_search.tpl
# attachment_mod/templates/subSilver/admin/attach_cp_user.tpl -> templates/subSilver/admin/attach_cp_user.tpl
# attachment_mod/templates/subSilver/admin/attach_extension_groups.tpl -> templates/subSilver/admin/attach_extension_groups.tpl
# attachment_mod/templates/subSilver/admin/attach_extensions.tpl -> templates/subSilver/admin/attach_extensions.tpl
# attachment_mod/templates/subSilver/admin/attach_forbidden_extensions.tpl -> templates/subSilver/admin/attach_forbidden_extensions.tpl
# attachment_mod/templates/subSilver/admin/attach_manage_body.tpl -> templates/subSilver/admin/attach_manage_body.tpl
# attachment_mod/templates/subSilver/admin/attach_quota_body.tpl -> templates/subSilver/admin/attach_quota_body.tpl
# attachment_mod/templates/subSilver/admin/attach_shadow.tpl -> templates/subSilver/admin/attach_shadow.tpl
# attachment_mod/templates/subSilver/admin/extension_groups_permissions.tpl -> templates/subSilver/admin/extension_groups_permissions.tpl
# attachment_mod/language/lang_english/lang_admin_attach.php -> language/lang_english/lang_admin_attach.php
# attachment_mod/language/lang_english/lang_faq_attach.php -> language/lang_english/lang_faq_attach.php
# attachment_mod/language/lang_english/lang_main_attach.php -> language/lang_english/lang_main_attach.php
# attachment_mod/install/install.php -> install/install.php
# attachment_mod/install/schemas/attach_mysql_basic.sql -> install/schemas/attach_mysql_basic.sql
# attachment_mod/install/schemas/attach_mysql_schema.sql -> install/schemas/attach_mysql_schema.sql
# attachment_mod/install/schemas/attach_mssql_basic.sql -> install/schemas/attach_mssql_basic.sql
# attachment_mod/install/schemas/attach_mssql_schema.sql -> install/schemas/attach_mssql_schema.sql
# attachment_mod/install/schemas/attach_postgres_basic.sql -> install/schemas/attach_postgres_basic.sql
# attachment_mod/install/schemas/attach_postgres_schema.sql -> install/schemas/attach_postgres_schema.sql
#
#
# If you want/have another language, please visit http://www.opentools.de/ and download your
# Language if it is available. If you have a multi-lingual board you may want to upload all language files.
# Please make sure you download the Language Pack for at least Version 2.3.9 of the Attachment Mod.
#
#
# STEP NUMBER II: Installing the Attachment Mod (Database)
#
# You should have uploaded the install folder (above), which is only needed for running the database installer.
# Make sure you uploaded the schema Files (those files ending in .sql) in ASCII Mode (This is the Layout and Data for your Database):
#
#
#
# Now we want to create the tables, therefore we run the install.php file (http://www.yoursite.com/phpBB2/install/install.php)
# Please be sure to enter the correct URL (replacing www.yoursite.com with your sites URL),
# the install.php file has to be placed within the install folder. If it is not within the install folder, you WILL get errors.
#
# After the install.php file hass been executed successfully, you should remove the complete install folder.
#
#
#
#
# STEP NUMBER III: Modifying existing phpBB2 Files
#
# Now you have to alter existing phpBB2 files, read the instructions carefully and make sure you find the correct lines.
# The Line Numbers are only a hint, most of the time they are not correct, especially if you have Mods installed.
#
#
#
#-----[ OPEN ]---------------------------------------------
#
common.php
#
#-----[ FIND ]---------------------------------------------
# around line 218
$board_config[$row['config_name']] = $row['config_value'];
}
#
#-----[ AFTER, ADD ]--------------------------------------
# After the closing brace
include($phpbb_root_path . 'attach_mod/attachment_mod.'.$phpEx);
#
#-----[ OPEN ]---------------------------------------------
#
faq.php
#
#-----[ FIND ]---------------------------------------------
# around line 62
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/' . $lang_file . '.' . $phpEx);
#
#-----[ AFTER, ADD ]---------------------------------------
#
attach_faq_include($lang_file);
#
#-----[ OPEN ]---------------------------------------------
#
modcp.php
#
#-----[ FIND ]---------------------------------------------
# around line 348
remove_search_post($post_id_sql);
#
#-----[ AFTER, ADD ]---------------------------------------
#
delete_attachment(explode(', ', $post_id_sql));
#
#-----[ FIND ]---------------------------------------------
# around line 1222
'TOPIC_ID' => $topic_id,
#
#-----[ AFTER, ADD ]---------------------------------------
#
'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($row['topic_attachment']),
#
#-----[ OPEN ]---------------------------------------------
#
posting.php
#
#-----[ FIND ]---------------------------------------------
# around line 422
$attach_sig = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? 0 : $userdata['user_attachsig'] );
#
#-----[ AFTER, ADD ]---------------------------------------
#
execute_posting_attachment_handling();
#
#-----[ FIND ]---------------------------------------------
# around line 580
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
}
#
#-----[ AFTER, ADD ]---------------------------------------
# the Line have to be added AFTER the closing brace
$attachment_mod['posting']->insert_attachment($post_id);
#
#-----[ FIND ]---------------------------------------------
# around line 715
'preview' => 'posting_preview.tpl')
);
#
#-----[ AFTER, ADD ]---------------------------------------
# the Line have to be added AFTER the ');'
$attachment_mod['posting']->preview_attachments();
#
#-----[ OPEN ]---------------------------------------------
#
privmsg.php
#
#-----[ FIND ]---------------------------------------------
# around line 131
// ----------
// Start main
#
#-----[ BEFORE, ADD ]--------------------------------------
#
execute_privmsgs_attachment_handling($mode);
#
#-----[ FIND ]---------------------------------------------
# around line 350
//
// Pick a folder, any folder, so long as it's one below ...
#
#-----[ BEFORE, ADD ]--------------------------------------
#
$attachment_mod['pm']->duplicate_attachment_pm($privmsg['privmsgs_attachment'], $privmsg['privmsgs_id'], $privmsg_sent_id);
#
#-----[ FIND ]---------------------------------------------
# around line 490
$user_id_to = $privmsg['user_id_2'];
#
#-----[ AFTER, ADD ]---------------------------------------
#
init_display_pm_attachments($privmsg['privmsgs_attachment']);
#
#-----[ FIND ]---------------------------------------------
# around line 750
$mark_list[] = $row['privmsgs_id'];
}
unset($delete_type);
#
#-----[ AFTER, ADD ]---------------------------------------
#
$attachment_mod['pm']->delete_all_pm_attachments($mark_list);
#
#-----[ FIND ]---------------------------------------------
# around line 1319
if ( $mode != 'edit' )
{
//
// Add to the users new pm counter
//
#
#-----[ BEFORE, ADD ]---------------------------------------
# The Line has to be added BEFORE 'if ( $mode != 'edit' )'
$attachment_mod['pm']->insert_attachment_pm($privmsg_id);
#
#-----[ FIND ]---------------------------------------------
# around line 1624
"preview" => 'privmsgs_preview.tpl')
);
#
#-----[ AFTER, ADD ]---------------------------------------
# The Line have to be added AFTER the ');'
$attachment_mod['pm']->preview_attachments();
#
#-----[ FIND ]---------------------------------------------
# around line 2169
'DATE' => $msg_date,
#
#-----[ AFTER, ADD ]---------------------------------------
#
'PRIVMSG_ATTACHMENTS_IMG' => privmsgs_attachment_image($privmsg_id),
#
#-----[ OPEN ]---------------------------------------------
#
viewforum.php
#
#-----[ FIND ]---------------------------------------------
# around line 370
$s_auth_can .= ( ( $is_auth['auth_vote'] ) ? $lang['Rules_vote_can'] : $lang['Rules_vote_cannot'] ) . '
';
#
#-----[ AFTER, ADD ]---------------------------------------
#
attach_build_auth_levels($is_auth, $s_auth_can);
#
#-----[ FIND ]---------------------------------------------
# around line 648
'NEWEST_POST_IMG' => $newest_post_img,
#
#-----[ AFTER, ADD ]---------------------------------------
#
'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($topic_rowset[$i]['topic_attachment']),
#
#-----[ OPEN ]---------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]---------------------------------------------
# around line 152
AND f.forum_id = t.forum_id
$order_sql";
#
#-----[ AFTER, ADD ]---------------------------------------
#
attach_setup_viewtopic_auth($order_sql, $sql);
#
#-----[ FIND ]---------------------------------------------
# around line 587
$s_auth_can .= ( ( $is_auth['auth_vote'] ) ? $lang['Rules_vote_can'] : $lang['Rules_vote_cannot'] ) . '
';
#
#-----[ AFTER, ADD ]---------------------------------------
#
attach_build_auth_levels($is_auth, $s_auth_can);
#
#-----[ FIND ]---------------------------------------------
# around line 817
//
// Update the topic view counter
#
#-----[ BEFORE, ADD ]---------------------------------------
#
init_display_post_attachments($forum_topic_data['topic_attachment']);
#
#-----[ FIND ]---------------------------------------------
# around line 1209
'U_POST_ID' => $postrow[$i]['post_id'])
);
#
#-----[ AFTER, ADD ]---------------------------------------
# The Line have to be added AFTER the ');' and BEFORE the '}' (without single quotes)
display_post_attachments($postrow[$i]['post_id'], $postrow[$i]['post_attachment']);
#
#-----[ OPEN ]---------------------------------------------
#
admin/admin_forumauth.php
#
#-----[ FIND ]---------------------------------------------
# around line 72
$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN);
#
#-----[ AFTER, ADD ]---------------------------------------
#
attach_setup_forum_auth($simple_auth_ary, $forum_auth_fields, $field_names);
#
#-----[ OPEN ]---------------------------------------------
#
admin/admin_forums.php
#
#-----[ FIND ]---------------------------------------------
# around line 52
//
// Mode setting
#
#-----[ BEFORE, ADD ]---------------------------------------
#
$forum_auth_ary['auth_attachments'] = AUTH_REG;
$forum_auth_ary['auth_download'] = AUTH_REG;
#
#-----[ OPEN ]---------------------------------------------
#
admin/admin_groups.php
#
#-----[ FIND ]---------------------------------------------
# around line 59
if ( isset($HTTP_POST_VARS['edit']) || isset($HTTP_POST_VARS['new']) )
#
#-----[ BEFORE, ADD ]---------------------------------------
#
attachment_quota_settings('group', $HTTP_POST_VARS['group_update'], $mode);
#
#-----[ OPEN ]---------------------------------------------
#
admin/admin_ug_auth.php
#
#-----[ FIND ]---------------------------------------------
# around line 91
// ---------------
// Start Functions
#
#-----[ BEFORE, ADD ]---------------------------------------
#
attach_setup_usergroup_auth($forum_auth_fields, $auth_field_match, $field_names);
#
#-----[ OPEN ]---------------------------------------------
#
admin/admin_users.php
#
#-----[ FIND ]---------------------------------------------
# around line 62
//
// Ok, the profile has been modified and submitted, let's update
#
#-----[ BEFORE, ADD ]---------------------------------------
#
attachment_quota_settings('user', $HTTP_POST_VARS['submit'], $mode);
#
#-----[ OPEN ]---------------------------------------------
#
includes/auth.php
#
#-----[ FIND ]---------------------------------------------
# around line 105
case AUTH_ATTACH:
break;
default:
break;
}
#
#-----[ AFTER, ADD ]---------------------------------------
# the Line have to be added AFTER the closing brace
attach_setup_basic_auth($type, $auth_fields, $a_sql);
#
#-----[ OPEN ]---------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]---------------------------------------------
# around line 319
//
// Set up style
#
#-----[ BEFORE, ADD ]---------------------------------------
#
include_attach_lang();
#
#-----[ OPEN ]---------------------------------------------
#
includes/functions_admin.php
#
#-----[ FIND ]---------------------------------------------
# around line 184
}
break;
}
return true;
#
#-----[ BEFORE, ADD ]---------------------------------------
#
attachment_sync_topic($id);
#
#-----[ OPEN ]---------------------------------------------
#
includes/prune.php
#
#-----[ FIND ]---------------------------------------------
# around line 113
remove_search_post($sql_post);
#
#-----[ AFTER, ADD ]---------------------------------------
#
prune_attachments($sql_post);
#
#-----[ OPEN ]---------------------------------------------
#
includes/topic_review.php
#
#-----[ FIND ]---------------------------------------------
# around line 43
WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id";
#
#-----[ AFTER, ADD ]---------------------------------------
#
$tmp = '';
attach_setup_viewtopic_auth($tmp, $sql);
#
#-----[ FIND ]---------------------------------------------
# around line 120
//
// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
#
#-----[ BEFORE, ADD ]---------------------------------------
#
init_display_review_attachments($is_auth);
#
#-----[ FIND ]---------------------------------------------
# around line 203
'L_MINI_POST_ALT' => $mini_post_alt)
);
#
#-----[ AFTER, ADD ]---------------------------------------
# the Line have to be added AFTER the ');'
display_review_attachments($row['post_id'], $row['post_attachment'], $is_auth);
#
#-----[ OPEN ]---------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]---------------------------------------------
# around line 175
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
#
#-----[ AFTER, ADD ]---------------------------------------
#
display_upload_attach_box_limits($profiledata['user_id']);
#
#-----[ OPEN ]---------------------------------------------
#
templates/subSilver/modcp_body.tpl
#
#-----[ FIND ]---------------------------------------------
# around line 27