| Server IP : 104.21.21.239 / Your IP : 216.73.216.11 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
switch($_GET['func']) :
case 'load_label_guests' :
//var_dump($_GET);
if ($_GET['rpt'] == 'invitation_envelopes_outer' || $_GET['rpt'] == 'invitation_envelopes_inner') :
$sql = "SELECT g.id, g.invitation_text, g.salutation, g.first_name, g.last_name, g.suffix ".
"FROM guests g WHERE (g.invite_temple = 1 OR g.invite_av = 1 OR g.invite_kv = 1 OR g.invite_dv = 1 OR g.invite_bv = 1) AND g.invitation_send = 1 ".
"AND g.user_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['user_id'])." AND g.event_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['active_event'])." ORDER BY g.last_name, g.first_name ";
elseif ($_GET['rpt'] == 'thank_you_envelopes') :
$sql = "SELECT g.id, g.invitation_text, g.salutation, g.first_name, g.last_name, g.suffix ".
"FROM guests g WHERE g.gift_received = 1 AND g.gift_thank_you <> 1 ".
"AND g.user_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['user_id'])." AND g.event_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['active_event'])." ORDER BY g.last_name, g.first_name ";
endif;
//echo $sql.'=====';
$result = mysqli_query($GLOBALS['con'], $sql);
if (mysqli_num_rows($result) > 0) :
while($row = mysqli_fetch_object($result)) :
if (!empty($row->invitation_text)) :
$guest_text = $row->invitation_text;
else :
$guest_text = format_guest_name_string($row->salutation, $row->first_name, $row->last_name, $row->suffix);
endif;
echo '<input type="checkbox" name="label_specific_id_list[]" value="'.$row->id.'" /> '.$guest_text.'<br />';
endwhile;
else :
echo 'No data for report!';
endif;
break;
case 'generate_pdf' :
ini_set('display_errors', '0');
ini_set("pcre.backtrack_limit","10000000");
ini_set("memory_limit","1024M");
include("mpdf61/mpdf.php");
if ($_POST['envelope_unit_measure'] == 'in') :
$uom_factor = 25.4;
else :
$uom_factor = 1.0;
endif;
$margin_top = 9;
$margin_left = 9;
$margin_bottom = 9;
$margin_right = 9;
$page_width = $_POST['envelope_width'] * $uom_factor;
$page_height = $_POST['envelope_height'] * $uom_factor;
$cell_width = $page_width * 0.65;
$cell_height = $page_height * 0.60;
$alignment = $_POST['alignment'];
switch($alignment) :
case 'left' :
$cell_left = $page_width * 0.30 - $margin_left;
break;
case 'center' :
$cell_left = $page_width * 0.18 - $margin_left;
break;
case 'right' :
$cell_left = $page_width * 0.05 - $margin_left;
break;
endswitch;
$cell_top = $page_height * 0.40 - $margin_top;
$return_cell_width = $page_width * 0.50;
$return_cell_height = $page_height * 0.25;
$return_cell_left = 0;
$return_cell_top = 0;
$line_height_factor = ($_POST['font_size'] + 1) / ($_POST['font_size']);
$mpdf=new mPDF('',array($page_width,$page_height),'','',$margin_left,$margin_right,$margin_top,$margin_bottom,0,0);
$mpdf->debug = false;
$mpdf->useOnlyCoreFonts = false; // false is default
//$mpdf->SetAutoFont(AUTOFONT_RTL);
$mpdf->keep_table_proportions = true;
//$mpdf->SetProtection(array('copy','print'));
$mpdf->SetProtection(array('copy','print','modify','annot-forms','fill-forms','extract','assemble','print-highres'), '', '');
$mpdf->SetTitle("MitzvahOrganizer.com - Report");
$mpdf->SetAuthor("MitzvahOrganizer.com");
$mpdf->SetDisplayMode('fullpage');
/*
ob_start();
var_dump($_POST);
$result = ob_get_clean();
*/
$html = '<html><body style="font-family: '.$_POST['font_style'].'; font-size: '.$_POST['font_size'].'pt; line-height: '.($_POST['font_size'] + 1).'pt; ">';
$guest_id_list = '';
if ($_POST['print_selection'] == 'specific') :
$guest_id_list = implode(',', $_POST['label_specific_id_list']);
$guest_id_list = ' AND g.id IN ('.$guest_id_list.') ';
endif;
if ($_POST['rpt'] == 'invitation_envelopes_outer') :
$sql = "SELECT g.*,(SELECT s.state_name from states s WHERE s.state = g.state) AS state_name ".
"FROM guests g WHERE (g.invite_temple = 1 OR g.invite_av = 1 OR g.invite_kv = 1 OR g.invite_dv = 1 OR g.invite_bv = 1) AND g.invitation_send = 1 ".$guest_id_list.
"AND g.user_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['user_id'])." AND g.event_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['active_event'])." ORDER BY g.last_name, g.first_name ";
elseif ($_POST['rpt'] == 'invitation_envelopes_inner') :
$sql = "SELECT g.invitation_text, g.salutation, g.last_name, g.first_name, g.suffix ".
"FROM guests g WHERE (g.invite_temple = 1 OR g.invite_av = 1 OR g.invite_kv = 1 OR g.invite_dv = 1 OR g.invite_bv = 1) AND g.invitation_send = 1 ".$guest_id_list.
"AND g.user_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['user_id'])." AND g.event_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['active_event'])." ORDER BY g.last_name, g.first_name ";
elseif ($_POST['rpt'] == 'thank_you_envelopes') :
$sql = "SELECT g.*,(SELECT s.state_name from states s WHERE s.state = g.state) AS state_name ".
"FROM guests g WHERE g.gift_received = 1 AND g.gift_thank_you <> 1 ".$guest_id_list.
"AND g.user_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['user_id'])." AND g.event_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['active_event'])." ORDER BY g.last_name, g.first_name ";
endif;
$result = mysqli_query($GLOBALS['con'], $sql);
$row_count = mysqli_num_rows($result);
$print_on = false;
$row_ix = 0;
if ($row_count > 0) :
while($row = mysqli_fetch_object($result)) :
$row_ix = $row_ix + 1;
if ($_POST['print_return_address'] == '1') :
$html .= '<div style="position:fixed; overflow:hidden; width:'.$return_cell_width.'mm; height:'.$return_cell_height.'mm; left: '.$return_cell_left.'mm; top:'.$return_cell_top.'mm; " >';
$html .= '<table style="overflow:hidden; font-size:11pt; line-height:12pt;"><tr><td valign="top" style="white-space:wrap; padding:0; padding-left:2mm; height:'.$inner_cell_height.'mm; ">';
$html .= nl2br($_POST['return_address']);
$html .= '</td></tr></table>';
$html .= '</div>';
endif;
$html .= '<div style="position:fixed; overflow:hidden; width:'.$cell_width.'mm; height:'.$cell_height.'mm; left: '.$cell_left.'mm; top:'.$cell_top.'mm; " >';
$html .= '<table style="overflow:hidden; line-height:'.$line_height_factor.';"><tr><td valign="top" style="white-space:wrap; padding:0; padding-left:2mm; height:'.$inner_cell_height.'mm; width:'.$cell_width.'mm; text-align:'.$alignment.'; ">';
if ($_POST['state_names'] == 'long' && !empty($row->state_name)) :
$row->state = $row->state_name;
endif;
$html .= format_address($row->invitation_text, $row->invitation_text2, $row->salutation, $row->first_name, $row->last_name, $row->suffix, $row->street, $row->street2, $row->city, $row->state, $row->zip, $row->country);
$html .= '</td></tr></table>';
$html .= '</div>';
if ($row_ix < $row_count) :
$html .= '<pagebreak />';
endif;
endwhile;
else :
$html .= 'No data for report!';
endif;
//$html .= 'dimension x: '.$page_dimension_x.' y: '.$page_dimension_y.' orientation: '.$orientation;
$html .= '</body></html>';
$mpdf->WriteHTML($html);
$mpdf->Output();
break;
endswitch;
?>