*********************************************************************************
* MOD NAME: UBB.Uploader *
*********************************************************************************
* DESCRIPTION: Lets users upload files. Allowed files are choosable from CP. *
* DEMO: http://www.pavioni.com/ubb/ultimatebb.php *
* username: ubbtest password: test *
* *
*********************************************************************************
* CREATED BY: Brett *
* DATE: 05/04/04 *
* VERSION: version 3.0 *
* CREDITS: Allen Ayres, LK and freeTV, And of course Ely_M :) *
* *
*********************************************************************************
*********************************************************************************
* REQUIREMENTS: Full License *
* COMPATABILITY: works with v6.7x, v6.6? *
*********************************************************************************
* FILES ADDED: ubb_upload.cgi *
* FILES MODIFIED: cp2_vars.cgi, cp2_lib.cgi, cp2_membermanage.cgi, ubb_lib.cgi *
* vars_wordlets_cp2.cgi, vars_wordlets.cgi, cp2_forums2.cgi, *
* cp2_forumedit.pl, cp2_editprofile.pl, *
* public_edit_post.pl, public_new_reply_form.pl, *
* public_new_topic_form.pl, public_pm_form.pl *
* public_topic_page.pl, public_avatar_select.pl *
*********************************************************************************
* DISCLAIMER: By using this modification, the user implicitly agrees *
* that they are willingly modifying any and all files at *
* their own risk. Should any errors occur either as a *
* direct or indirect result of said modifications the user *
* agrees not to hold Infopop Corporation or any of the *
individuals listed accountable. *
* *
* *
* IN OTHER WORDS: PLEASE MAKE BACKUP COPIES OF EVERY FILE YOU PLAN TO *
* MODIFY PRIOR TO MODIFICATION!! *
* *
* *
* FOR MORE TIPS AND TRICKS FOR USE WITH THE ULTIMATE BULLETIN BOARD *
* PLEASE US AT VISIT: *
* *
* https://ubbdev.com/ *
* *
*********************************************************************************
*********************************************************************************
########################################################
###Open cp2_vars.cgi
########################################################
########
# find #
########
&Template($vars_wordlets_cp2{"vars_config-_-enableaccel-description"}, {});
#############
# add below #
#############
use vars qw($UPLOADSUB);
$UPLOADSUB = sub {
no strict;
my $r = ""; # deja vu
foreach(qw(administrators moderators senior_members junior_members)) {
next if($_ eq 'megamoderators' && !&FileExists("$vars_config{VariablesPath}/vars_megamods.cgi"));
$vars_misc{"upload_limit_$_"} ||= '15000';
my $check1 = ($vars_misc{"upload_$_"} eq 1 ? ' checked="checked"' : '');
my $check2 = ($vars_misc{"upload_avatar_$_"} eq 1 ? ' checked="checked"' : '');
$r .= qq~
<tr>
<td style="border-right: 1px dotted black">
$vars_wordlets_cp2{"generics-$_"}
</td>
<td>
<span class="autorow-title">
<input type="checkbox" name="vars_misc::upload_$_" value="1"$check1 />
</span>
</td>
<td>
<span class="autorow-title">
<input type="checkbox" name="vars_misc::upload_avatar_$_" value="1"$check2 />
</span>
</td>
<td>
<span class="autorow-title">
<input type="text" name="vars_misc::upload_limit_$_" value="$vars_misc{"upload_limit_$_"}" />
</span>
</td>
<td>
<span class="autorow-title">
<input type="text" name="vars_misc::upload_filelimit_$_" value="$vars_misc{"upload_filelimit_$_"}" />
</span>
</td>
</tr>~}
return $r};
########
# find #
########
vars_misc::FloodCheckSpan
)],
#############
# add below #
#############
{
type => "header",
level => 2,
title => $vars_wordlets_cp2{'upload-_-title'},
},[qw(
vars_misc::upload
vars_misc::upload_unreg
vars_misc::upload_dir
vars_misc::upload_url
vars_misc::upload_extreg
vars_misc::upload_extavt
vars_misc::upload_administrators
vars_misc::upload_avatar_administrators
vars_misc::upload_limit_administrators
vars_misc::upload_filelimit_administrators
vars_misc::upload_moderators
vars_misc::upload_avatar_moderators
vars_misc::upload_limit_moderators
vars_misc::upload_filelimit_moderators
vars_misc::upload_senior_members
vars_misc::upload_avatar_senior_members
vars_misc::upload_limit_senior_members
vars_misc::upload_filelimit_senior_members
vars_misc::upload_junior_members
vars_misc::upload_avatar_junior_members
vars_misc::upload_limit_junior_members
vars_misc::upload_filelimit_junior_members
)], {
type => 'header',
level => 2,
title => "Upload Permissions",
}, {
type => 'raw',
content => qq~
<tr bgcolor="#F1F1DB">
<td width="50%" valign="top" class="paddingtop paddingbottom autorow" align="left" colspan="2">
<table width="100%" cellpadding="4" cellspacing="2" border="0">
<tr style="border-bottom: 1px dotted black">
<td style="border-right: 1px dotted black"></td>
<td>
<span class="autorow-title">
$vars_wordlets_cp2{'upload-_-titlebar-allow'}
</span>
</td>
<td>
<span class="autorow-title">
$vars_wordlets_cp2{'upload-_-titlebar-custom'}
</span>
</td>
<td>
<span class="autorow-title">
$vars_wordlets_cp2{'upload-_-titlebar-limit'}
</span>
</td>
<td>
<span class="autorow-title">
$vars_wordlets_cp2{'upload-_-titlebar-filelimit'}
</span>
</td>
</tr>~
}, {
type => 'raw',
content => &$UPLOADSUB
}, {
type => 'raw',
content => qq~</table></td></tr>~
},
########
# find #
########
}; # end return
} # end define_vars_misc
#############
# add above #
#############
upload => {
type => "checkbox",
values => [qw(yes no)],
default => "yes",
},
upload_unreg => {
type => "checkbox",
values => [qw(yes no)],
default => "yes",
},
upload_dir => {
type => "text",
length => 50,
maxlength => 100,
default => "15",
},
upload_url => {
type => "text",
length => 50,
maxlength => 100,
default => "15",
},
upload_extreg => {
type => "text",
length => 50,
maxlength => 100,
default => "15",
},
upload_extavt => {
type => "text",
length => 50,
maxlength => 100,
default => "15",
},
q!upload_administrators! => { type => "checkbox", private => 1, req => 0, },
q!upload_avatar_administrators! => { type => "checkbox", private => 1, req => 0, },
q!upload_limit_administrators! => { type => "text", private => 1, req => 0, },
q!upload_filelimit_administrators! => { type => "text", private => 1, req => 0, },
q!upload_moderators! => { type => "checkbox", private => 1, req => 0, },
q!upload_avatar_moderators! => { type => "checkbox", private => 1, req => 0, },
q!upload_limit_moderators! => { type => "text", private => 1, req => -1, },
q!upload_filelimit_moderators! => { type => "text", private => 1, req => -1, },
q!upload_senior_members! => { type => "checkbox", private => 1, req => 0, },
q!upload_avatar_senior_members! => { type => "checkbox", private => 1, req => 0, },
q!upload_limit_senior_members! => { type => "text", private => 1, req => -1, },
q!upload_filelimit_senior_members! => { type => "text", private => 1, req => -1, },
q!upload_junior_members! => { type => "checkbox", private => 1, req => 0, },
q!upload_avatar_junior_members! => { type => "checkbox", private => 1, req => 0, },
q!upload_limit_junior_members! => { type => "text", private => 1, req => -1, },
q!upload_filelimit_junior_members! => { type => "text", private => 1, req => -1, },
########################################################
###Open vars_wordlets_cp2.cgi
########################################################
##########
# add in #
##########
q!vars_misc-_-upload! => q!Allow uploading?!,
q!vars_misc-_-upload-description! => q!Allow users on your board to upload files!,
q!vars_misc-_-upload_unreg! => q!Allow uploads by unregistered users?!,
q!vars_misc-_-upload_unreg-description! => q!Do you want allow unregistered user to upload their files? It can pose security risk, if you wish to allow this!,
q!vars_misc-_-upload_dir! => q!Upload Path!,
q!vars_misc-_-upload_dir-description! => q!Path to where files will be placed!,
q!vars_misc-_-upload_url! => q!Upload URL!,
q!vars_misc-_-upload_url-description! => q!The http link to the path where the files will be placed.!,
q!vars_misc-_-upload_extreg! => q!Allowable Extentsions for Regular Files!,
q!vars_misc-_-upload_extreg-description! => q!Seperate each extentsion with spaces. For example, "zip txt tar.gz tar".!,
q!vars_misc-_-upload_extavt! => q!Allowable Extentsions for Avatars!,
q!vars_misc-_-upload_extavt-description! => q!Only these will be available for uploading custom avatars, you can seperate extenstion by a space. Example: "gif jpeg jpg", without the quotes.!,
q!upload-_-forum! => q!Groups Allowed To Upload!,
q!upload-_-title! => q!Upload Settings!,
q!upload-_-titlebar-allow! => q!Allow Uploads!,
q!upload-_-titlebar-custom! => q!Allow Upload Avatars!,
q!upload-_-titlebar-limit! => q!Maximum Size Of Upload!,
q!upload-_-titlebar-filelimit! => q!Maximum # Of Files!,
q!upload-_-profile! => q!Allowed to upload files!,
q!upload-_-profile-description! => q!!,
q!upload-_-profile-all! => q!Allow user to upload all the time. Ignore user group setting.!,
q!upload-_-profile-no! => q!Never allow user to upload.!,
q!upload-_-profile-reg! => q!Follow default user group rules.!,
########################################################
###Open vars_wordlets.cgi
########################################################
##########
# add in #
##########
q!upload-_-link! => q!Upload File Form!,
q!upload-_-form-title! => q!%%BBTITLE%% Upload Form!,
q!upload-_-form-submit! => q! Upload !,
q!upload-_-form-link! => q!Upload File!,
q!upload-_-form-manager! => q!Upload Manager!,
q!upload-_-manager-title! => q!%%BBTITLE%% Upload Manager!,
q!upload-_-manager-delete! => q!Delete!,
q!upload-_-manager-file! => q!Filename!,
q!upload-_-manager-nofiles! => q!No files detected!,
q!upload-_-bad_directory! => q!We apologize but either i can't create, look at, or write this to directory. Please alert the administration about the '%%DIR%%' directory.!,
q!upload-_-back_directory! => q!» Back 1 Directory!,
q!upload-_-need_to_login! => q!You need to be logged in to upload here. Please close this window, logged in then try again.!,
q!upload-_-bad_status! => q!Unable to determine status. Please inform the board administrators about this error.!,
q!upload-_-forum_deny! => q!File Uploading is not allowed in this forum.!,
q!upload-_-full_deny! => q!You do not have permission to access this area.!,
q!upload-_-invalid_ref! => q!Unable to parse your referer. Are you sure you clicked on it through the forums?!,
q!upload-_-no_ref! => q!Unable to detect referer. You must click the upload link directly to upload files.!,
q!upload-_-invalid_ext! => q!You are trying to upload something with an illegal extentsion. The currently allowed are: %%FILE%%, and you tried to upload a %%EXT%% file(s).
<a href="javascript: void(history.back(-1))">Click here to go back.</a>!,
q!upload-_-filesize_over! => q!The file you were trying to upload has exceeded the maximum of %%GOOD%% bytes. We stopped the upload at %%BAD%% bytes.!,
q!upload-_-up_success! => q!The file you uploaded was successful. You can access it by clicking <a href="%%LINK%%" target="_new">here</a>.
You may also copy the following statement to use the hyperlink in your posts.
%%LINK%%
<a href="%%BACK%%">Click here to upload more files</a> or <a href="%%MANAGER%%">Click here to manage your uploaded files</a>!,
q!upload-_-cant_delete! => q!I was unable to delete the following file. Please alert the administration.
%%FILE%%!,
q!upload-_-at_limit! => q!You are currently at your limit to upload. To upload anymore files, please delete some files out of your upload manager.
<a href="%%BACK%%">Click here for the upload manager</a>.!,
q!upload-_-up_avtsuccess! => q!%%JS%%Avatar successfully uploaded. Click <a href="javascript: void(ChangeAvatar())">Here</a> to load the url to the custom avatar field!,
q!upload-_-custom_avatar! => q!Upload A Custom Avatar!,
########################################################
###Open cp2_lib.cgi
########################################################
########
# find #
########
if($def->{private}) {
#############
# add below #
#############
next VAR if($file eq "vars_misc");
########################################################
###Open cp2_forumedit.pl
########################################################
########
# find #
########
# TODO - remove access
#############
# add below #
#############
my $upload_list = {
type => "radio",
title => $vars_wordlets_cp2{'upload-_-forum'},
name => "upload",
options => @topic_options,
class => "paddingtop paddingbottom",
};
########
# find #
########
$topic_select, $reply_select, $private_container,
################
# replace with:#
################
$topic_select, $reply_select, $upload_list, $private_container,
########################################################
###Open cp2_forums.cgi
########################################################
########
# find #
########
# Now, make sure no |^ got slipped through..
#############
# add above #
#############
# Upload Hackmap
$original[23] = $in{upload};
########
# find #
######## (all occurances of)
$vars_forums{$_} }[0 .. 17]
################
# replace with:#
################
$vars_forums{$_} }[0 .. 23]
########################################################
###Open ubb_lib.cgi
########################################################
########
# find #
########
$vars_config{'MaxMemFields'} = 43;
################
# replace with:#
################
$vars_config{'MaxMemFields'} = 71; #total fields permitted in member file(this is a large number so it does not conflict with other hacks)
########
# find #
########
my @check = (split (/|^|/, $one))[0 .. 17];
################
# replace with:#
################
my @check = (split (/|^|/, $one))[0 .. 23];
########################################################
###Open cp2_editprofile.pl
########################################################
########
# find #
########
]), &MakeComponentHTML([
# Tab 3 - fields
#############
# add above #
#############
{
class => "autotop", # fix for stupid expandy problem
type => "radio",
name => "upload",
title => $vars_wordlets_cp2{'upload-_-profile'},
desc => $vars_wordlets_cp2{'upload-_-profile-description'},
options => [
{
name => $vars_wordlets_cp2{'upload-_-profile-all'},
value => 'all',
selected => $profile[70] == "all" ? 1 : 0,
},
{
name => $vars_wordlets_cp2{'upload-_-profile-reg'},
value => 'reg',
selected => $profile[70] =~ m/reg/ ? 1 : 0,
},
{
name => $vars_wordlets_cp2{'upload-_-profile-no'},
value => 'no',
selected => $profile[70] !~ m/^(all|reg)$/ ? 1 : 0,
},
],
},
########################################################
###Open cp2_membermanage.cgi
########################################################
########
# find #
########
$profile->[32] = join("|", @bdi);
#############
# add below #
#############
$profile->[70] = $in{upload};
########################################################
###Open public_avatar_select.pl
########################################################
########
# find #
########
$TBB_Popup
#############
# add below #
#############
<center>
<table width="95%"><tr>
<td align="right">
<font face="$vars_style{FontFace}" size="$vars_style{FDTextSize}">
<a href="javascript: void(0)" onclick="window.open('$vars_config{CGIURL}/ubb_upload.cgi?f=avatar', 'uploader', 'toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no,status=no,width=570,height=350'); return false;"><b>$vars_wordlets{'upload-_-custom_avatar'}</b></a>
</font>
</td></tr></table>
</center>
########################################################
###Open public_edit_post.pl, public_new_reply_form.pl
### public_new_topic_form.pl, public_pm_form.pl
########################################################
########
# find #
########
$ubb_images_wording
#############
# add below #
#############
<a href="javascript: void(0)" onclick="window.open('$vars_config{CGIURL}/ubb_upload.cgi', 'uploader', 'toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no,status=no,width=570,height=350'); return false;"><b>$vars_wordlets{'upload-_-link'}</b></a>
########################################################
###Open public_topic_page.pl
########################################################
########
# find #
########
$graem_list
#############
# add below #
#############
<a href="javascript: void(0)" onclick="window.open('$vars_config{CGIURL}/ubb_upload.cgi', 'uploader', 'toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no,status=no,width=570,height=350'); return false;"><b>$vars_wordlets{'upload-_-link'}</b></a>
************************************************
* Okay, now upload all files and it should work.