###############################################
## MOD Title: Formats Upload
## MOD Author: Garibaldi (Garibaldi@wiscollectorcar.com)
http://www.wiscollectorcar.com## MOD Description: Allows you to associate a file with each image in your gallery, e.g. a zip archive of files related to that image
## MOD Version: 1.1.1
## Installation Level: Easy
## Installation Time: 10 minutes
## Files To Edit: 7
## upload.php
## editpics.php
## editOnePic.php
## include/picmgmt.inc.php
## lang/english.php
## formats_upload.php
## formats_helper.php
## Included Files:
## formats_upload/
## images/formats_upload.png
## js/fileprogress.js
## js/handlers.js
## swfupload.js
## swfupload.queue.js
## swfupload.swf
## swfuploadbutton.swf
## License:
http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## Author Notes:
## This modification uses the
http://swfupload.org/ upload script
##############################################################
## MOD History:
## 2009-06-30- version 1.1.1 bugfix to correct the slashes in the upload URL for Windows servers
## 2009-06-01- version 1.1.0 added unique filenames for uploads
## 2009-04-17- version 1.0.0
##############################################################
## Before Adding This MOD To Your Coppermine install, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ IN COPPERMINE ]---------------------------------
#
Log in as an administrator and go to Config. Expand the section
"Custom fields for image description (leave blank if unused)" and
enter a name in "Field 1 name" like "Other Formats". Save the new
configuration
#
#-----[ UPLOAD ]----------------------------------------
#
Upload all files in this package to you Coppermine root directory
#
#-----[ OPEN ]------------------------------------------
#
upload.php
#
#-----[ FIND ]------------------------------------------
#
// Create a text box.
echo <<<EOT
#
#-----[ BEFORE, ADD ]-----------------------------------
#
// s garibaldi
global $lang_upload_php;
if ($text == $CONFIG['user_field1_name']) {
$text = $text . ' <input type="button" onclick="window.open(\'formats_upload.php\',\'user1\',\'status=0,toolbar=0,location=0,menubar=0,height=300,width=420,resizable=1\')" value="' . $lang_upload_php['other_formats_button'] . '" class="button" /> ';
}
// e garibaldi
#
#-----[ OPEN ]------------------------------------------
#
editpics.php
#
#-----[ FIND ]------------------------------------------
#
echo <<<EOT
<tr>
<td class="tableb" style="white-space: nowrap;">
$text
</td>
<td width="100%" class="tableb" valign="top">
<input type="text" style="width: {$field_width}%" name="$name" maxlength="$max_length" value="$value" class="textinput" />
</td>
</tr>
EOT;
#
#-----[ REPLACE WITH ]----------------------------------
#
// s garibaldi
global $CONFIG, $lang_editpics_php;
if ($text == $CONFIG['user_field1_name']) {//ereg($CONFIG['user_field1_name'], $text)) {
$text = $text . ' <input type="button" onclick="window.open(\'formats_upload.php\',\'' . $name . '\',\'status=0,toolbar=0,location=0,menubar=0,height=300,width=420,resizable=1\')" value="' . $lang_editpics_php['other_formats_button'] . '" class="button" /> ';
}
echo <<<EOT
<tr>
<td class="tableb" style="white-space: nowrap;">
$text
</td>
<td width="100%" class="tableb" valign="top">
<input type="text" style="width: {$field_width}%" id="$name" name="$name" maxlength="$max_length" value="$value" class="textinput" />
</td>
</tr>
EOT;
// e garibaldi
#
#-----[ OPEN ]------------------------------------------
#
editOnePic.php
#
#-----[ FIND ]------------------------------------------
#
echo <<<EOT
<tr>
<td class="tableb" style="white-space: nowrap;">
{$CONFIG['user_field1_name']}
</td>
<td width="100%" class="tableb" valign="top">
<input type="text" style="width: 100%" name="user1" maxlength="255" value="{$CURRENT_PIC['user1']}" class="textinput" />
</td>
</tr>
EOT;
#
#-----[ REPLACE WITH ]----------------------------------
#
// s garibaldi
global $lang_editpics_php;
$other_formats = ' <input type="button" onclick="window.open(\'formats_upload.php\',\'user1\',\'status=0,toolbar=0,location=0,menubar=0,height=300,width=420,resizable=1\')" value="' . $lang_editpics_php['other_formats_button'] . '" class="button" /> ';
echo <<<EOT
<tr>
<td class="tableb" style="white-space: nowrap;">
{$CONFIG['user_field1_name']}{$other_formats}
</td>
<td width="100%" class="tableb" valign="top">
<input type="text" style="width: 100%" id="user1" name="user1" maxlength="255" value="{$CURRENT_PIC['user1']}" class="textinput" />
</td>
</tr>
EOT;
// e garibaldi
#
#-----[ OPEN ]------------------------------------------
#
include/picmgmt.inc.php
#
#-----[ FIND ]------------------------------------------
#
$image = $CONFIG['fullpath'] . $filepath . $filename;
$normal = $CONFIG['fullpath'] . $filepath . $CONFIG['normal_pfx'] . $filename;
$thumb = $CONFIG['fullpath'] . $filepath . $CONFIG['thumb_pfx'] . $filename;
#
#-----[ AFTER, ADD ]------------------------------------
#
// s garibaldi
// ******************** //
// *** START CONFIG *** //
// ******************** //
$user1_path = "/var/htdocs/cpg14x/formats_upload/"; // NOTE: even if you are using Windows, use forward slashes "/" for paths - e.g. C:/windows/
$user1_url = "
http://mycpgroot.com/formats_upload/";
$extension = "zip";
// ******************** //
// **** END CONFIG **** //
// ******************** //
$user1_file = substr($filename, 0, strlen($filename)-3) . $extension;
// check to see if user1 not set already and exists in the specified dir
if(($user1 == '') && is_file($user1_path . $user1_file)) {
$user1 = $user1_url . $user1_file;
}
// e garibaldi
#
#-----[ NOTE ]------------------------------------------
#
Edit the lines the lines after START CONFIG and before END CONFIG,
adjusting the path of the upload folder for the files. This folder should
not be inside your Coppermine albums folder. Its permissions may also need
to be adjusted to 777 to allow upload. You can also adjust the type of files
that can be uploaded. By default only .zip files are allowed
#
#-----[ OPEN ]------------------------------------------
#
lang/english.php
#
#-----[ FIND ]------------------------------------------
#
$log_date_fmt = '%B %d, %Y at %I:%M %p'; //cpg1.4
#
#-----[ AFTER, ADD ]------------------------------------
#
// s garibaldi
$other_formats_button="Add Formats";
// e garibaldi
#
#-----[ FIND ]------------------------------------------
#
'forb_ext' => 'Forbidden file extension.',//cpg1.4
#
#-----[ AFTER, ADD ]------------------------------------
#
'other_formats_button' => $other_formats_button, // garibaldi
#
#-----[ FIND ]------------------------------------------
#
'regenerate_dictionary' => 'Regenerate Dictionary', //cpg1.4
#
#-----[ AFTER, ADD ]------------------------------------
#
'other_formats_button' => $other_formats_button, // garibaldi
#
#-----[ NOTE ]------------------------------------------
#
These same language modifications can be applied to other languages as well.
Just replace the english text with your native language
#
#-----[ OPEN ]------------------------------------------
#
formats_upload.php
#
#-----[ FIND ]------------------------------------------
#
var upload_url = "
http://mycpgroot.com/formats_upload/";
#
#-----[ EDIT ]------------------------------------------
#
Change the URL to point to the formats_upload folder inside your Coppermine Root
#
#-----[ OPEN ]------------------------------------------
#
formats_helper.php
#
#-----[ FIND ]------------------------------------------
#
$save_path = "/var/htdocs/cpg14x/formats_upload/";
#
#-----[ EDIT ]------------------------------------------
#
Edit the path to point to your system's path to the formats_upload folder. This
looks like the above example on linux/unix servers and on Windows might look like
C:\webserver\cpg14x\formats_upload
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#
# EoM