##############################################################
## MOD Title: Slideshow Photo Album Mod
## MOD Version: 1.0.2
## Attachment Mod Version: 2.3.7-2.3.9
##
## Author: vHiker < tomdav@yahoo.com > (Tom Davenport)
## Description: This mod adds slideshow & photo album features
##  to the attachment mod.  When someone clicks on a thumbnail
##  or image attachment link, this mod will display the image
##  in a slideshow viewer with thumbnails for navigation and
##  two drop down selection boxes for the following "user" &
##  "month" albums: a "user" album is created for each user
##  that has uploaded an image, and a "month" album is created
##  for any month an image has been posted.  This mod will
##  ignore images attached in private messages or posted in
##  forums the user does not have permission to view, as well
##  as images for which width & height cannot be determined.
##
## Installation Level: moderate
## Installation Time: 15 Minutes
## Files To Edit:  download.php
##                 search.php
##                 includes/page_header.php
##                 attach_mod/posting_attachments.php
##                 language/lang_english/lang_main_attach.php
##                 templates/subSilver/overall_header.tpl
##                 templates/subSilver/subSilver.cfg
##
## Included Files: templates/subsilver/slideshow.tpl
##                 templates/subSilver/slideshow_header.tpl
##                 templates/subSilver/album.tpl
##                 slideshow.php
##                 install_slideshow.php
##############################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## Authors Notes: In addition to the changes below you MUST
##                upload install_slideshow.php to the
##                directory phpbb is installed in and run it!
##
## This Addon does NOT work if you use the FTP Upload Method
## with an empty download path.
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
# Upload the following files: slideshow.php, templates/subsilver/slideshow.tpl, templates/subSilver/slideshow_header.tpl and templates/subSilver/album.tpl
#
# Upload install_slideshow.php, run it and then delete it after running it (see Authors Notes)
#

#
#-----[ OPEN ]------------------------------------------
#
download.php

#
#-----[ FIND ]------------------------------------------
# (around Line 299)
init_userprefs($userdata);

#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'slideshow.'.$phpEx);

#
#-----[ OPEN ]------------------------------------------
#
search.php

#
#-----[ FIND ]------------------------------------------
# (around Line 71)
$show_results = ( isset($HTTP_POST_VARS['show_results']) ) ? $HTTP_POST_VARS['show_results'] : 'posts';

#
#-----[ REPLACE WITH ]------------------------------------------
#
$show_results = ( isset($HTTP_POST_VARS['show_results']) ) ? $HTTP_POST_VARS['show_results'] : ( ( isset($HTTP_GET_VARS['show_results']) ) ? $HTTP_GET_VARS['show_results'] : 'posts' );

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

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

#
#-----[ REPLACE WITH ]------------------------------------------
#
$template->set_filenames(array(
	'overall_header' => ( empty($gen_simple_header) ) ? 'overall_header.tpl' : (($gen_simple_header < 0) ? 'slideshow_header.tpl' : 'simple_header.tpl') )
);

#
#-----[ OPEN ]------------------------------------------
#
attach_mod/posting_attachments.php

#
#-----[ FIND ]------------------------------------------
# (around line 627)
						// Update Entry
						$sql = "UPDATE " . ATTACHMENTS_DESC_TABLE . " 
						SET physical_filename = '" . $this->attach_filename . "', real_filename = '" . $this->filename . "', comment = '" . $comment . "', extension = '" . $this->extension . "', mimetype = '" . $this->type . "', filesize = " . $this->filesize . ", filetime = " . $this->filetime . ", thumbnail = " . $this->thumbnail . "
						WHERE attach_id = " . $attachment_id;

#
#-----[ REPLACE WITH ]------------------------------------------
#
						// Update Entry
						global $upload_dir;
						$width = 0; $height = 0;
						if (substr($this->type, 0, 5) == 'image')
						{
							list($width, $height) = image_getdimension($upload_dir . '/' . $this->attach_filename);
						}
						$sql = "UPDATE " . ATTACHMENTS_DESC_TABLE . " 
						SET physical_filename = '" . $this->attach_filename . "', real_filename = '" . $this->filename . "', comment = '" . $comment . "', extension = '" . $this->extension . "', mimetype = '" . $this->type . "', filesize = " . $this->filesize . ", filetime = " . $this->filetime . ", thumbnail = " . $this->thumbnail . ", width = " . intval($width) . ", height = " . intval($height) . "
						WHERE attach_id = " . $attachment_id;

#
#-----[ FIND ]------------------------------------------
# (around line 763)
					//
					// insert attachment into db 
					//
					$sql = "INSERT INTO " . ATTACHMENTS_DESC_TABLE . " (physical_filename, real_filename, comment, extension, mimetype, filesize, filetime, thumbnail) 
					VALUES ( '" . $this->attachment_list[$i] . "', '" . str_replace("'", "''", $this->attachment_filename_list[$i]) . "', '" . trim($this->attachment_comment_list[$i]) . "', '" . $this->attachment_extension_list[$i] . "', '" . $this->attachment_mimetype_list[$i] . "', " . $this->attachment_filesize_list[$i] . ", " . $this->attachment_filetime_list[$i] . ", " . $this->attachment_thumbnail_list[$i] . ")";

#
#-----[ REPLACE WITH ]------------------------------------------
#
					//
					// insert attachment into db 
					//
					$width = 0; $height = 0;
					if (substr($this->attachment_mimetype_list[$i], 0, 5) == 'image')
					{
						list($width, $height) = image_getdimension($upload_dir . '/' . $this->attachment_list[$i]);
					}
					$sql = "INSERT INTO " . ATTACHMENTS_DESC_TABLE . " (physical_filename, real_filename, comment, extension, mimetype, filesize, filetime, thumbnail, width, height) 
					VALUES ( '" . $this->attachment_list[$i] . "', '" . str_replace("'", "''", $this->attachment_filename_list[$i]) . "', '" . trim($this->attachment_comment_list[$i]) . "', '" . $this->attachment_extension_list[$i] . "', '" . $this->attachment_mimetype_list[$i] . "', " . $this->attachment_filesize_list[$i] . ", " . $this->attachment_filetime_list[$i] . ", " . $this->attachment_thumbnail_list[$i] . ", " . intval($width) . ", " . intval($height) . ")";

#
#-----[ FIND ]------------------------------------------
# (around line 797)
				//
				// insert attachment into db, here the user submited it directly 
				//
				$sql = "INSERT INTO " . ATTACHMENTS_DESC_TABLE . " (physical_filename, real_filename, comment, extension, mimetype, filesize, filetime, thumbnail) 
				VALUES ( '" . $this->attach_filename . "', '" . str_replace("'", "''", stripslashes($this->filename)) . "', '" . trim($this->file_comment) . "', '" . $this->extension . "', '" . $this->type . "', " . $this->filesize . ", " . $this->filetime . ", " . $this->thumbnail . ")";

#
#-----[ REPLACE WITH ]------------------------------------------
#
				//
				// insert attachment into db, here the user submited it directly 
				//
				$width = 0; $height = 0;
				if (substr($this->type, 0, 5) == 'image')
				{
					list($width, $height) = image_getdimension($upload_dir . '/' . $this->attach_filename);
				}
				$sql = "INSERT INTO " . ATTACHMENTS_DESC_TABLE . " (physical_filename, real_filename, comment, extension, mimetype, filesize, filetime, thumbnail, width, height) 
				VALUES ( '" . $this->attach_filename . "', '" . str_replace("'", "''", stripslashes($this->filename)) . "', '" . trim($this->file_comment) . "', '" . $this->extension . "', '" . $this->type . "', " . $this->filesize . ", " . $this->filetime . ", " . $this->thumbnail . ", " . intval($width) . ", " . intval($height) . ")";

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main_attach.php

#
#-----[ FIND ]------------------------------------------
# (at the very end of the file)
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
// For Slideshow Photo Album Mod
$lang['Download_times'] = 'File downloaded or viewed %d times';
$lang['By_username'] = 'By Username';
$lang['By_month'] = 'By Month &nbsp;&nbsp;';  // 3 extra spaces to make the drop down a little wider (looks better beside much wider username drop down)
$lang['Pics'] = 'Pics';
$lang['Previous'] = 'Previous';
$lang['Next_user'] = 'Next User';
$lang['Next_month'] = 'Next Month';
$lang['More'] = 'more';
$lang['Active_topics'] = 'Active Topics';
$lang['Number_of_total'] = '%d of %d';
$lang['Random_pic'] = 'Random Pic';
$lang['Posted_by'] = 'Posted By';
$lang['In'] = 'In';
$lang['Or'] = 'or';
$lang['Add_border'] = 'Add Border';
$lang['Remove_border'] = 'Remove Border';
$lang['Edit_post'] = 'Edit Post';
$lang['View_profile'] = 'View Profile';
$lang['View_post'] = 'View Post';
$lang['Stop'] = 'Stop';

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

#
#-----[ FIND ]------------------------------------------
#
<style type="text/css">
<!--

#
#-----[ AFTER, ADD ]------------------------------------------
#
/* For Slideshow Photo Album Mod */
.imageborder { color: {T_FONTCOLOR1}; border-color: {T_FONTCOLOR1}; }

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

#
#-----[ FIND ]------------------------------------------
#
$images['icon_quote'] = "$current_template_images/{LANG}/icon_quote.gif";

#
#-----[ BEFORE, ADD ]------------------------------------------
#
$images['icon_mini_search'] = "$current_template_images/icon_mini_search.gif";

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