| Server IP : 104.21.21.239 / Your IP : 216.73.216.201 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/mitzvahm/planner/mod/ |
Upload File : |
<?php include('_mod_security.php'); ?>
<?php
if (empty($_SESSION['active_event'])) :
?>
<h3>No Bar/Bat Mitzvah defined - please create or activate a Bar/Bat Mitzvah!</h3>
<?php
exit();
endif;
//var_dump($_POST);
//var_dump($_GET);
if ($_SERVER['HTTPS'] != "on") :
$url_prefix = 'http';
else :
$url_prefix = 'https';
endif;
$rpt = mysqli_real_escape_string($GLOBALS['con'], trim($_GET['rpt']));
$success = 0;
// *** venue ***
$sql = "SELECT * FROM events WHERE user_id = ".$_SESSION['user_id']." AND id = ".$_SESSION['active_event']." ";
$result_event = mysqli_query($GLOBALS['con'], $sql);
$num_venues = 0;
if (mysqli_num_rows($result_event) > 0) :
$row_event = mysqli_fetch_object($result_event);
if (!empty($row_event->temple_name)) :
$ar_venue['temple'] = venue_decode('temple');
endif;
if (!empty($row_event->av_name)) :
$ar_venue['av'] = venue_decode('av');
endif;
if (!empty($row_event->kv_name)) :
$ar_venue['kv'] = venue_decode('kv');
endif;
if (!empty($row_event->bv_name)) :
$ar_venue['bv'] = venue_decode('bv');
endif;
if (!empty($row_event->dv_name)) :
$ar_venue['dv'] = venue_decode('dv');
endif;
$current_venue_name = reset($ar_venue);
$current_venue = key($ar_venue);
if (!empty($_GET['venue'])) :
$current_venue = $_GET['venue'];
endif;
$current_venue = mysqli_real_escape_string($GLOBALS['con'], trim($current_venue));
endif;
$return_address = str_ireplace('<br />', "\n", format_address('', '', '', $_SESSION['user_first_name'], $_SESSION['user_last_name'], '', $row_event->family_address, $row_event->family_address2, $row_event->family_city, $row_event->family_state, $row_event->family_zip, $row_event->family_country));
// *****************************
?>
<script>
var active_tab = '';
var label_margin_left = 0;
var label_margin_top = 0;
var label_unit_measure = 'in';
var label_orientation = 'P';
var envelope = [];
envelope['width'] = 7.0;
envelope['height'] = 5.0;
envelope['max_width'] = 230;
envelope['max_height'] = 230;
envelope['min_width'] = 75;
envelope['min_height'] = 75;
set_label_font_size = function(size)
{
$('#envelope_preview_inner').css({
'font-size' : size + 'pt',
'line-height' : (parseInt(size) + 1) + 'pt'
});
}
set_label_font_style = function(style)
{
$('#envelope_preview_inner').removeClass(function (index, className) {
return (className.match (/(^|\s)label_style_\S+/g) || []).join(' ');
});
$('#envelope_preview_return').removeClass();
setTimeout(function() {
$('#envelope_preview_inner').addClass('label_style_' + style);
$('#envelope_preview_return').addClass('label_style_' + style);
}, 500);
}
function set_alignment(alignment)
{
$('#envelope_preview_inner').removeClass('envelope_preview_inner_left envelope_preview_inner_center envelope_preview_inner_right');
$('#envelope_preview_inner').addClass('envelope_preview_inner_' + alignment);
}
set_preview_state = function(style)
{
var str = $('#envelope_preview_inner').html();
if (style == 'long')
{
str = str.replace('Anywhere Heights, NY', 'Anywhere Heights, New York');
$('#envelope_preview_inner').html(str);
}
else
{
str = str.replace('Anywhere Heights, New York', 'Anywhere Heights, NY');
$('#envelope_preview_inner').html(str);
}
}
set_guest_all = function()
{
$('#label_guest_selection').html('');
$('#label_guest_selection').hide();
}
set_guest_specific = function()
{
$('#label_guest_selection').load('ajax.php?call=envelopes_ajax&func=load_label_guests&rpt=' + encodeURI('<?php echo $rpt; ?>'),
function()
{
$('#label_guest_selection').show();
} );
}
show_pdf_warning = function()
{
alert('IMPORTANT: A PDF file will be generated. When printing the PDF, make sure to consult your printer documentation for correct envelope printing setup - paper tray, orientation, etc. Also, make sure to set "Page Scaling" to "NONE" in the Print Dialog in order to preserve correct line-up. We suggest you first try printing just one envelope to verify correct printer setup.');
return true;
}
function val_dimension_field(field, dimension)
{
field.value = trim(field.value);
if ($('input:radio[name=envelope_unit_measure]:checked').val() == 'mm')
{
envelope[dimension] = parseFloat(field.value || 0);
if (envelope[dimension] > envelope['max_' + dimension])
envelope[dimension] = envelope['max_' + dimension];
if (envelope[dimension] < envelope['min_' + dimension])
envelope[dimension] = envelope['min_' + dimension];
field.value = num2str(envelope[dimension],0,"",0,"-","");
}
else
{
envelope[dimension] = parseFloat(field.value || 0);
if (envelope[dimension] * 25.4 > envelope['max_' + dimension])
envelope[dimension] = envelope['max_' + dimension] / 25.4;
if (envelope[dimension] * 25.4 < envelope['min_' + dimension])
envelope[dimension] = envelope['min_' + dimension] / 25.4;
field.value = num2str(envelope[dimension],3,"",0,"-","");
}
}
change_uom = function()
{
if ($('input:radio[name=envelope_unit_measure]:checked').val() == 'mm')
{
envelope['width'] = parseFloat($('#envelope_width').val() || 0) * 25.4;
envelope['height'] = parseFloat($('#envelope_height').val() || 0) * 25.4;
$('#envelope_width').val(num2str(envelope['width'],0,",",0,"-",""));
$('#envelope_height').val(num2str(envelope['height'],0,",",0,"-",""));
$('#height_uom').text('mm');
$('#width_uom').text('mm');
}
else
{
envelope['width'] = parseFloat($('#envelope_width').val() || 0) / 25.4;
envelope['height'] = parseFloat($('#envelope_height').val() || 0) / 25.4;
$('#envelope_width').val(num2str(envelope['width'],3,",",0,"-",""));
$('#envelope_height').val(num2str(envelope['height'],3,",",0,"-",""));
$('#height_uom').text('in.');
$('#width_uom').text('in.');
}
val_dimension_field(document.forms['frm_report'].elements['envelope_width'], 'width');
val_dimension_field(document.forms['frm_report'].elements['envelope_height'], 'height');
resize_preview();
}
resize_preview = function()
{
$('#envelope_preview').css({
'width' : (envelope['width']) + $('input:radio[name=envelope_unit_measure]:checked').val(),
'height' : (envelope['height']) + $('input:radio[name=envelope_unit_measure]:checked').val()
});
}
toggle_return_address = function()
{
$('#row_return_address').toggle();
update_return_address();
$('#envelope_preview_return').toggle();
}
update_return_address = function()
{
$('#envelope_preview_return').html(nl2br($('#return_address').val()));
}
$(document).ready(function()
{
//switch_tab('<?php echo $active_tab; ?>');
//***** Load label font stylesheets *******
$('head').append("<link href='<?php echo $url_prefix; ?>://fonts.googleapis.com/css?family=Bree+Serif' rel='stylesheet' type='text/css'>");
$('head').append("<link href='<?php echo $url_prefix; ?>://fonts.googleapis.com/css?family=Paytone+One' rel='stylesheet' type='text/css'>");
$('head').append("<link href='<?php echo $url_prefix; ?>://fonts.googleapis.com/css?family=Bevan' rel='stylesheet' type='text/css'>");
$('head').append("<link href='<?php echo $url_prefix; ?>://fonts.googleapis.com/css?family=Average+Sans' rel='stylesheet' type='text/css'>");
$('head').append("<link href='<?php echo $url_prefix; ?>://fonts.googleapis.com/css?family=Pinyon+Script' rel='stylesheet' type='text/css'>");
$('head').append("<link href='<?php echo $url_prefix; ?>://fonts.googleapis.com/css?family=Archivo+Black' rel='stylesheet' type='text/css'>");
$('head').append("<link href='<?php echo $url_prefix; ?>://fonts.googleapis.com/css?family=Chivo' rel='stylesheet' type='text/css'>");
$('head').append("<link href='<?php echo $url_prefix; ?>://fonts.googleapis.com/css?family=Rochester' rel='stylesheet' type='text/css'>");
$('head').append("<link href='<?php echo $url_prefix; ?>://fonts.googleapis.com/css?family=Playball' rel='stylesheet' type='text/css'>");
$("#tab_content_general").show();
$('#font_style').val('breeserif').change();
$('#font_size').val('16').change();
$('#alignment_left').change();
resize_preview();
}
)
</script>
<h1><?php echo htmlspecialchars(get_report_name($rpt)); ?></h1>
<?php get_help_guide('help_envelopes'); ?>
<form name="frm_report" id="frm_report" method="post" target="_blank" action="ajax.php?call=envelopes_ajax&func=generate_pdf" onsubmit="show_pdf_warning();" >
<input name="ajax_event_submitted" type="hidden" value="1" />
<input name="rpt" type="hidden" value="<?php echo $rpt; ?>" />
<input name="active_tab" id="active_tab" type="hidden" value="general" />
<input name="label_margin_left" id="label_margin_left" type="hidden" />
<input name="label_margin_top" id="label_margin_top" type="hidden" />
<input name="label_unit_measure" id="label_unit_measure" type="hidden" />
<input name="label_orientation" id="label_orientation" type="hidden" />
<div class="cleardiv">
</div>
<div class="tab_content" id="tab_content_general">
<div class="form_header">
Envelope Specification Criteria
</div>
<table class="input_block" width="870">
<tr>
<td width="400">
<table>
<tr>
<td width="140">
Units of Measure:
</td>
<td>
<input type="radio" name="envelope_unit_measure" value="in" checked="checked" onchange="change_uom();" />Inches
<input type="radio" name="envelope_unit_measure" value="mm" onchange="change_uom();" />Milllimeters
</td>
</tr>
<tr>
<td>
Width:
</td>
<td width="200">
<input name="envelope_width" id="envelope_width" type="text" maxlength="10" value="7.000" style="width:65px; text-align:right;" onblur="val_dimension_field(this, 'width'); resize_preview();" />
<span id="width_uom">in.</span>
</td>
</tr>
<tr>
<td>
Height:
</td>
<td>
<input name="envelope_height" id="envelope_height" type="text" maxlength="10" value="5.000" style="width:65px; text-align:right;" onblur="val_dimension_field(this, 'height'); resize_preview();" />
<span id="height_uom">in.</span>
</td>
</tr>
<?php
if ($_GET['type'] == 'invitation_outer' || $_GET['type'] == 'thank_you') :
?>
<tr>
<td>
State names:
</td>
<td>
<input type="radio" name="state_names" id="state_names_short" value="short" checked="checked" onchange="set_preview_state($(this).val());" />Abbreviated
<input type="radio" name="state_names" id="state_names_long" value="long" onchange="set_preview_state($(this).val());" />Expanded
</td>
</tr>
<tr>
<td>
Print return address:
</td>
<td>
<input name="print_return_address" id="print_return_address" type="checkbox" value="1" onchange="toggle_return_address();" />
</td>
</tr>
<tr id="row_return_address" style="display:none;">
<td colspan="2">
<textarea name="return_address" id="return_address" style="width:300px; height:65px;" cols="100" rows="5" onblur="update_return_address();" ><?php echo $return_address; ?></textarea>
</td>
</tr>
<?php
endif;
?>
</table>
</td>
<td>
<table>
<tr>
<td>
Print selection:
</td>
<td>
<input type="radio" name="print_selection" value="all" checked="checked" onchange="set_guest_all();" />All envelopes
<input type="radio" name="print_selection" value="specific" onchange="set_guest_specific();" />Specific envelopes
<div id="label_guest_selection" style="width:300px;">
</div>
</td>
</tr>
<tr>
<td>
Font style:
</td>
<td>
<select name="font_style" id="font_style" onchange="set_label_font_style($(this).val());">
<option value="breeserif">Bree Serif</option>
<option value="paytoneone">Paytone One</option>
<option value="bevan">Bevan</option>
<option value="averagesans">Average Sans</option>
<option value="pinyonscript">Pinyon Script</option>
<option value="archivoblack">Archivo Black</option>
<option value="chivo">Chivo</option>
<option value="rochester">Rochester</option>
<option value="playball">Playball</option>
</select>
</td>
</tr>
<tr>
<td>
Font size:
</td>
<td>
<select name="font_size" id="font_size" onchange="set_label_font_size($(this).val());">
<?php
for ($ix = 6; $ix <= 22; $ix++) :
echo '<option value="'.$ix.'">'.$ix.' pt.</option>';
endfor;
?>
</select>
</td>
</tr>
<tr>
<td>
Alignment:
</td>
<td>
<input type="radio" name="alignment" id="alignment_left" value="left" checked="checked" onchange="set_alignment($(this).val());" />Left
<input type="radio" name="alignment" id="alignment_center" value="center" onchange="set_alignment($(this).val());" />Center
<input type="radio" name="alignment" id="alignment_right" value="right" onchange="set_alignment($(this).val());" />Right
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<br /><strong>Sample Envelope Preview - Actual Size</strong><br />
<div id="envelope_preview">
<div id="envelope_preview_return" style="display:none;">
</div>
<div id="envelope_preview_inner" class="envelope_preview_inner_left">
Mr. & Mrs. Jonathan Anonymous<br />
<?php
if ($_GET['type'] == 'invitation_outer' || $_GET['type'] == 'thank_you') :
?>
12345 Very Long Name Avenue<br />
Apt. 12-B<br />
Anywhere Heights, NY 12345<br />
USA
<?php
endif;
?>
</div>
</div>
</td>
</tr>
</table>
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="form_strip">
<span class="form_message">
<?php echo $form_message; ?>
</span>
<input type="submit" value="Create PDF" />
<input type="button" value="Cancel" onclick="window.history.back();" />
</div>
</form>