############################################################## 
## MOD Title: pafiledb integration
## MOD Version: 0.0.9a
## MOD Author: squall < mohdalbasri@yahoo.com > (Mohammed Al-Basri) www.mohd.tk 
##	       MJ < mj@phpbbfm.net > www.phpbbfm.com
## MOD Description: Integration of pafiledb (Database download manager) with phpbb.
##                  pafiledb use header, footer, session, template, and database system
##		    of phpbb.
##			Only for phpBB 2.0.4!
## 
## Installation Level: (easy) 
## Installation Time: 10-15 Minutes 
## Files To Edit (10) : admin/index.php
##			includes/constant.php
##		       admin/admin_db_utilities.php
##		       includes/page_header.php, 
##                     language/lang_english/lang_main.php,
##                     templates/subSilver/admin/page_header.tpl,
##                     templates/subSilver/overall_header.tpl,
##		       templates/subSilver/subSilver.cfg
##
## Included Files:     dload.php,
##		       admin/admin_pa_catauth.php
##		       admin/admin_pa_category.php,
##		       admin/admin_pa_custom.php,
##		       admin/admin_pa_file.php,
##		       admin/admin_pa_license.php,
##		       admin/admin_pa_settings.php,
##		       language/*/lang_admin_pafiledb.php
##		       language/*/lang_pafiledb.php
##		       pafiledb/*.*,
##		       templates/subSilver/pa_*.tpl ( 18 )
##		       templates/subSilver/admin/pa_*.tpl ( 19 )
##		       templates/subSilver/images/icon_mini_download.gif
##		       templates/subSilver/images/lang_english/icon_pa_*.gif ( 9 )
##
##
############################################################## 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ 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/downloads/ 
############################################################## 
############################################################## 
## Author Note: 
## follow all the instruction below first then upload and run from your browser, 
## pafiledb/docs/pafiledb_installer.php (choose update from 0.0.8) and if you have the table already installed, 
## you won't need to change anything in them except that you won't need the admin table 
## since you are going to use ACP. 
##
## Create and CHMOD (0777) THE FOLLOWING DIRECTORIES:
## - pafiledb/uploads/
## - pafiledb/cache/
## - pafiledb/cache/file_size
## - pafiledb/cache/templates/subSilver/
## - pafiledb/cache/templates/subSilver/admin
## - pafiledb/explain
##	
##
## Change History:
##	0.0.9 : ADD/Fixed:
##		- THE WHOLE MOD IS RE WRITIEN 
##		- ADDED ALOT OF FEATURE
##		- FIXING ALOT OF SECURITY BUGS
##	0.0.8 : Added/Fixed:
##		- Fixed the global varaible problem. (you don't have to set global var to on)
##		- Changed the whole coding structure in all file.
##		- Comment viewing like the viewtopic.
##		- Added the file checker feature (beware if this one or you will end up erasing all file.)
##		- Changed some images and included them into templates/*/images/ folder.
##		- Main Templates cleaned up, added clickable folder icons.
##		- Fixed bug with category sort feature.
##		- Added edit download count when editing file.
##		- Added Dutch, German and Italian language support .
##
##	0.0.7 : Added/Fixed:
##		- Fixed bug with screen shot upload.
##		- Fixed bug with templates in ACP.
##		- Removed Variable $str found in search.php.
##		- Changed directory for images and icons.
##		- Changed all url and action to append_sid.
##
##	0.0.6 : Added/Fixed:
##		- Backupdb & restore to phpBB forum backup style
##		- Changed tables to phpbb style
##		- Show screenshots as image instead of link. (you may choose now either links or image).
##		- Long Description - Multiple line text area.
##		- Replaced pafiledb language with phpbb.
##		- Unlimited subCategories.
##		- Added Upload Screenshot feature (there is a small bugs on it)
##		- Added Disable "View All" link
##		- Added Disable Database feature
##		- comment feature (only registered users can post)
##		- Email is using phpBB class emailer.
##		- New File indicator you can now set the number of day to show that the file is new
##		- Added toplist file (you can now specify number of file that in toplist.
##		- Removed the following bugs:
##			* Replaced pafiledb Time Zone with phpbb.
##			* Replaced pafiledb Language with phpbb.
##			* Email fields can be left blank, but confirmation of email sent is returned. 
##			* Custom Field data not reading from db
##			* Time on posted comment
##			* Edit file (ACP), sub-cats & files not showing
##			* Backup Database screwed
##			* removing some un needed row from setting table like language and style.
##			* fixing the problem of jumpmenu fix in pafiledb.php file because file send the $str instead of $lang
##			* 'Comment Explain' text missing
##			* Title on posted comment
##			* max_comment_chars field in _settings table missing
##			* Javascript error when posting or previewing comment
##			* Email not actually sending to address ??? (Not for me anyway!)
##			* Time on file page
##
##	0.0.5 : - Re-packing of all working files
##     	 	- Changed paFileDB_installer.php
##
## 	0.0.4 : Fixed:
## 		- {dbname} showing in the email instead of the variable that should replace it.
## 		- Uploaded file not returning full URL.
## 		- Replaced pafiledb Time Zone with phpbb.
## 		- Email fields can be left blank, but confirmation of email sent is returned 
## 		- Fixed sort for viewall.. (sort according to rating not yet due to php version) 
## 		- Custom Field data not reading from db		
## 		- Added support for view online when some one in download page.
##
##	0.0.3 : - Fixed the editing file bug in ACP
##		- Fixed the the file in sub category bug.
##		- Fixed the uploading file url bug when uploading
##		- Changed message after rating or e-mail sending
##		- Made copywrite with phpbb copywrite only if you are in download database
##
##	0.0.2 : All templates made to fit phpBB default, clean up of code. 
##
## 	0.0.1 : First release, I need just to modify the *.tpl file in admin 
## 		section.
## 
##############################################################  
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# 
#-----[ COPY ]------------------------------------------ 
# 
copy dload.php to root 
copy admin/*.php to admin/ 
copy templates/subSilver/*.tpl to templates/subSilver/ 
copy templates/subSilver/admin/*.tpl to templates/subSilver/admin/
copy pafiledb/*.* to pafiledb/
copy language/lang_english/* to language/lang_english/*

# 
#-----[ SQL ]------------------------------------------ 
# 
run pafiledb/docs/pafiledb_installer.php or update.sql

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

# 
#-----[ FIND ]------------------------------------------ 
#

define('PA_CATEGORY_TABLE', $table_prefix.'pa_cat');
define('PA_COMMENTS_TABLE', $table_prefix.'pa_comments');
define('PA_CUSTOM_TABLE', $table_prefix.'pa_custom');
define('PA_CUSTOM_DATA_TABLE', $table_prefix.'pa_customdata');
define('PA_FILES_TABLE', $table_prefix.'pa_files');
define('PA_LICENSE_TABLE', $table_prefix.'pa_license');
define('PA_SETTINGS_TABLE', $table_prefix.'pa_settings');
define('PA_VOTES_TABLE', $table_prefix.'pa_votes');

# 
#-----[ REPLACE, WITH ]------------------------------------------ 
#  

//REMOVED


# 
#-----[ OPEN ]------------------------------------------ 
# 
admin/index.php
# 
#-----[ FIND ]------------------------------------------ 
# 
//
// pafiledb
//
include_once($phpbb_root_path . 'pafiledb/includes/functions.' . $phpEx); 
$config = pafiledb_config();
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin_pafiledb.' . $phpEx);
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#  

// REMOVED

# 
#-----[ OPEN ]------------------------------------------ 
# 
admin/admin_db_utilities.php
# 
#-----[ FIND ]------------------------------------------ 
# 
	include('./page_footer_admin.'.$phpEx);
}
$tables = array('auth_access', 'banlist', 'categories'....

# 
#-----[ FIND IN LINE ]------------------------------------------ 
# 
'pa_cat', 'pa_comments', 'pa_custom', 'pa_customdata', 'pa_files', 'pa_license', 'pa_settings', 'pa_votes', 

# 
#-----[ REPLACE, WITH ]------------------------------------------ 
# 
'pa_cat', 'pa_comments', 'pa_custom', 'pa_customdata', 'pa_files', 'pa_license', 'pa_config', 'pa_votes', 'pa_download_info'


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

# 
#-----[ FIND ]------------------------------------------ 
#  
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<SCRIPT LANGUAGE="JavaScript"> 
<!-- 
function mpFoto(img){ 
foto1= new Image(); 
foto1.src=(img); 
mpControl(img); 
} 
function mpControl(img){ 
if((foto1.width!=0)&&(foto1.height!=0)){ 
viewFoto(img); 
} 
else{ 
mpFunc="mpControl('"+img+"')"; 
intervallo=setTimeout(mpFunc,20); 
} 
} 
function viewFoto(img){ 
largh=foto1.width+20; 
altez=foto1.height+20; 
string="width="+largh+",height="+altez; 
finestra=window.open(img,"",string); 
} 
//--> 
</script> 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
<!-- removed --!>

# 
#-----[ OPEN ]------------------------------------------ 
#

includes/page_tail.php

# 
#-----[ FIND ]------------------------------------------ 
#  	

if ( defined('IN_DOWNLOAD') )
{
   $template->assign_block_vars("pa_copy", array());	
}

# 
#-----[ REPLACE, WITH ]------------------------------------------ 
# 

// Removed
# 
#-----[ OPEN ]------------------------------------------ 
#

templates/subSilver/overall_footer.tpl

# 
#-----[ FIND ]------------------------------------------ 
#  	

<!-- BEGIN pa_copy -->
& <a href="http://www.phparena.net/" target="_phparena" class="copyright">PHP Arena</a> paFileDB 3.1 &copy; 2002, 2003
<!-- END pa_copy -->

# 
#-----[ REPLACE, WITH ]------------------------------------------ 
# 

<!-- removed -->

# 
#-----[ OPEN ]------------------------------------------ 
#

templates/subSilver/subSilver.cfg

# 
#-----[ FIND ]------------------------------------------ 
# 
$images['pa_search'] = "$current_template_images/{LANG}/icon_pa_search.gif";
$images['pa_stats'] = "$current_template_images/{LANG}/icon_pa_stats.gif";
$images['pa_toplist'] = "$current_template_images/{LANG}/icon_pa_toplist.gif";
$images['pa_download'] = "$current_template_images/icon_pa_download.gif";
$images['pa_rate'] = "$current_template_images/icon_pa_rate.gif";
$images['pa_email'] = "$current_template_images/icon_pa_email.gif";

# 
#-----[ REPLACE, WITH ]------------------------------------------ 
# 
$images['pa_search'] = "$current_template_images/{LANG}/icon_pa_search.gif";
$images['pa_stats'] = "$current_template_images/{LANG}/icon_pa_stats.gif";
$images['pa_toplist'] = "$current_template_images/{LANG}/icon_pa_toplist.gif";
$images['pa_upload'] = "$current_template_images/{LANG}/icon_pa_upload.gif";
$images['pa_viewall'] = "$current_template_images/{LANG}/icon_pa_viewall.gif";
$images['pa_download'] = "$current_template_images/{LANG}/icon_pa_download.gif";
$images['pa_rate'] = "$current_template_images/{LANG}/icon_pa_rate.gif";
$images['pa_email'] = "$current_template_images/{LANG}/icon_pa_email.gif";
$images['pa_comment_post'] = "$current_template_images/{LANG}/icon_pa_post_comment.gif";
$images['pa_file_new'] = "$current_template_images/icon_pa_new.gif";


# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM  