SetProtection(explode(",",$permissions),$userpw,$ownerpw); } $pdf->AliasNbPages(); $pdf->SetDisplayMode($zoom,$layout); $pdf->SetMargins($leftmargin,$topmargin,$rightmargin); $pdf->SetAutoPageBreak(true,$bottommargin); $pdf->Open(); $pdf->SetCreator($doccreator); $pdf->SetTitle($doctitle); $pdf->SetSubject($docsubject); $pdf->SetAuthor($docauthor); switch ($pagesize) { case 'A4': if ($orientation=="P") { $x=210; $y=297; } else { $x=297; $y=210; } break; case 'A3': if ($orientation=="P") { $x=297; $y=420; } else { $x=420; $y=297; } break; case 'A5': if ($orientation=="P") { $x=148; $y=210; } else { $x=210; $y=148; } break; case 'Letter': if ($orientation=="P") { $x=216; $y=279; } else { $x=279; $y=216; } break; case 'Legal': if ($orientation=="P") { $x=216; $y=356; } else { $x=356; $y=216; } break; } $i=0; switch ($datefont) { case 'Arial': break; case 'Times': break; case 'Courier': break; default: $pdf->AddFont($datefont); $pdf->AddFont($datefont,'B',strtolower($datefont).'.php'); $pdf->AddFont($datefont,'I',strtolower($datefont).'.php'); break; } switch ($titlefont) { case 'Arial': break; case 'Times': break; case 'Courier': break; default: $pdf->AddFont($titlefont); $pdf->AddFont($titlefont,'B',strtolower($titlefont).'.php'); $pdf->AddFont($titlefont,'I',strtolower($titlefont).'.php'); break; } switch ($contentfont) { case 'Arial': break; case 'Times': break; case 'Courier': break; default: $pdf->AddFont($contentfont); $pdf->AddFont($contentfont,'B',strtolower($contentfont).'.php'); $pdf->AddFont($contentfont,'I',strtolower($contentfont).'.php'); break; } switch ($infofont) { case 'Arial': break; case 'Times': break; case 'Courier': break; default: $pdf->AddFont($infofont); $pdf->AddFont($infofont,'B',strtolower($infofont).'.php'); $pdf->AddFont($infofont,'I',strtolower($infofont).'.php'); break; } switch ($headerfont) { case 'Arial': break; case 'Times': break; case 'Courier': break; default: $pdf->AddFont($headerfont); $pdf->AddFont($headerfont,'B',strtolower($headerfont).'.php'); $pdf->AddFont($headerfont,'I',strtolower($headerfont).'.php'); break; } switch ($footerfont) { case 'Arial': break; case 'Times': break; case 'Courier': break; default: $pdf->AddFont($footerfont); $pdf->AddFont($footerfont,'B',strtolower($footerfont).'.php'); $pdf->AddFont($footerfont,'I',strtolower($footerfont).'.php'); break; } switch ($tocfont) { case 'Arial': break; case 'Times': break; case 'Courier': break; default: $pdf->AddFont($tocfont); $pdf->AddFont($tocfont,'B',strtolower($tocfont).'.php'); $pdf->AddFont($tocfont,'I',strtolower($tocfont).'.php'); break; } switch ($pagenrfont) { case 'Arial': break; case 'Times': break; case 'Courier': break; default: $pdf->AddFont($pagenrfont); $pdf->AddFont($pagenrfont,'B',strtolower($pagenrfont).'.php'); $pdf->AddFont($pagenrfont,'I',strtolower($pagenrfont).'.php'); break; } switch ($commentsfont) { case 'Arial': break; case 'Times': break; case 'Courier': break; default: $pdf->AddFont($commentsfont); $pdf->AddFont($commentsfont,'B',strtolower($commentsfont).'.php'); $pdf->AddFont($commentsfont,'I',strtolower($commentsfont).'.php'); break; } if ($displaytitle=="true") { if ($bkmarks=="true") { $pdf->Bookmark($titlename); } $pdf->SetY(0); $pdf->SetX(0); $pdf->Cell($x,$y-10,$titlename,0,0,'C'); } if ($toc=="true") { $pdf->AddPage(); $tocpage=$pdf->page; $tocwhere=$pdf->GetY(); if ($bkmarks=="true") { $pdf->Bookmark($toc_title); } } if ($order=="false") { $pdf->AddPage(); } foreach ($posts as $post) { start_wp2pdf(); $i=$i+1; if ($order=="true") { $pdf->AddPage(); } $date=the_date('','','',false); $time=stripslashes(wp2pdf_the_time('',false)); $title=get_the_title(); if (function_exists('iconv')) { if (iconv('UTF-8', 'UTF-8', $title) != $title) { // It's not UTF-8, must be something else } else { // It's UTF-8, convert to ISO-8859-1 $title=iconv("UTF-8","ISO-8859-1",$title); } } $trans = get_html_translation_table(HTML_ENTITIES); $trans = array_flip($trans); $title = strtr($title, $trans); $content = nl2br(wp2pdf_content()); if (function_exists('iconv')) { if (iconv('UTF-8', 'UTF-8', $content) != $content) { // It's not UTF-8, must be something else } else { // It's UTF-8, convert to ISO-8859-1 $content=iconv("UTF-8","ISO-8859-1",$content); } } $content = texturize($content); $content = texturize($content); // and again $content = unhtmlentities($content); $infobartext_new = str_replace('[TIME]', $time, $infobartext); $infobartext_new = str_replace('[DATE]', $date, $infobartext_new); $author=the_author('',false); $infobartext_new = str_replace('[AUTHOR]', $author, $infobartext_new); $category=wp2pdf_category(); $infobartext_new = str_replace('[CATEGORY]', $category, $infobartext_new); if ($show_date=="false") { } else { $pdf->SetFont($datefont,$datestyle,$datesize); $color=hex2dec($datecolor); $pdf->SetTextColor($color['R'],$color['G'],$color['B']); if ($date!="") { if ($bkmarks=="true") { $pdf->Bookmark($date); } #$pdf->SetLink($links[$i]); $pdf->Cell('',5,stripslashes($date),'','1',$datealign,'',''); $pdf->Ln(); } } if ($show_title=="false") { } else { $pdf->SetFont($titlefont,$titlestyle,$titlesize); $color=hex2dec($titlecolor); $pdf->SetTextColor($color['R'],$color['G'],$color['B']); if ($bkmarks=="true") { $pdf->Bookmark($title,1,-1); } #$pdf->SetLink($links[$i]); $pdf->MultiCell('',5,stripslashes($title),'',$titlealign,''); $pdf->Ln(); } if ($infobarplacement=="over") { if ($show_info=="false") { $pdf->Ln(); } else { $pdf->SetFont($infofont,$infostyle,$infosize); $color=hex2dec($infocolor); $pdf->SetTextColor($color['R'],$color['G'],$color['B']); $pdf->Cell('',5,$infobartext_new,'','1',$infoalign,'',''); $pdf->Ln(); } } if ($show_content=="false") { } else { $pdf->SetFont($contentfont,$contentstyle,$contentsize); $color=hex2dec($contentcolor); $pdf->SetTextColor($color['R'],$color['G'],$color['B']); $pdf->WriteHTML($content,$contentalign); $pdf->Ln(); } if ($infobarplacement=="under") { if ($show_info=="false") { $pdf->Ln(); } else { $pdf->Ln(); $pdf->SetFont($infofont,$infostyle,$infosize); $color=hex2dec($infocolor); $pdf->SetTextColor($color['R'],$color['G'],$color['B']); $pdf->Cell('',5,$infobartext_new,'','1',$infoalign,'',''); } $pdf->Ln(); } if (($show_comments=="true") AND (function_exists(wp2pdf_comment_type)) AND (function_exists(wp2pdf_comment_author)) AND (function_exists(wp2pdf_comment_author_email)) AND (function_exists(wp2pdf_comment_date)) AND (function_exists(wp2pdf_comment_time))) { $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date"); $pdf->Ln(); $pdf->Ln(); $pdf->SetFont($commentsfont,"B",$commentssize); $pdf->Cell('',5,$comments_trans,'','1',$infoalign,'',''); if ($comments) { foreach ($comments as $comment) { $commenttext=wp2pdf_comment_text(); if (function_exists('iconv')) { if (iconv('UTF-8', 'UTF-8', $commenttext) != $commenttext) { // It's not UTF-8, must be something else } else { // It's UTF-8, convert to ISO-8859-1 $commenttext=iconv("UTF-8","ISO-8859-1",$commenttext); } } $commenttext=trim(nl2br($commenttext)); #$commenttext=preg_replace( '!!iU', "\n", $commenttext); $commenttext=texturize($commenttext); $commenttext=texturize($commenttext); $commenttext=strip_tags($commenttext); $commentinfobartext_new = str_replace('[TYPE]', wp2pdf_comment_type(), $commentinfobartext); $commentinfobartext_new = str_replace('[AUTHOR]', wp2pdf_comment_author(), $commentinfobartext_new); #$commentinfobartext_new = str_replace('[EMAIL]', wp2pdf_comment_author_email(), $commentinfobartext_new); $commentinfobartext_new = str_replace('[DATE]', wp2pdf_comment_date(), $commentinfobartext_new); $commentinfobartext_new = str_replace('[TIME]', wp2pdf_comment_time(), $commentinfobartext_new); $color=hex2dec($commentscolor); $pdf->SetTextColor($color['R'],$color['G'],$color['B']); $pdf->Ln(); if ($commentinfobarplacement=="over") { $pdf->SetFont($commentsfont,$commentsstyle,$commentssize); $pdf->SetX(+20); $pdf->MultiCell(0,5,$commentinfobartext_new,'','1',$commentsalign,'',''); $pdf->Ln(); } $pdf->SetX(+20); $pdf->SetFont($commentsfont,"I",$commentssize); $commenttext = unhtmlentities($commenttext); $commenttext = texturize($commenttext); $commenttext = texturize($commenttext); $pdf->MultiCell(0,5,$commenttext,'','1',$commentsalign,'',''); $pdf->Ln(); if ($commentinfobarplacement=="under") { $pdf->SetFont($commentsfont,$commentsstyle,$commentssize); $pdf->SetX(+20); $pdf->MultiCell(0,5,$commentinfobartext_new,'','1',$commentsalign,'',''); $pdf->Ln(); } } } else { $pdf->Ln(); $color=hex2dec($commentscolor); $pdf->SetTextColor($color['R'],$color['G'],$color['B']); $pdf->SetFont($commentsfont,$commentsstyle,$commentssize); $pdf->SetX(+20); $pdf->Cell('',5,$nocomments_trans,'','1',$commentsalign,'',''); } } $pdf->Ln(); if ($order=="false") { $pdf->Ln(); $pdf->Ln(); } } if (($toc=="true") AND ($bkmarks=="true")) { $last=$pdf->page; $pdf->page=$tocpage; $pdf->SetY($tocwhere); $pdf->CreateIndex(); $pdf->page=$last; } $pdffilename = str_replace('[CURDAY]',date('d'), $pdffilename); $pdffilename = str_replace('[CURMONTH]',date('m'), $pdffilename); $pdffilename = str_replace('[CURYEAR]',date('Y'), $pdffilename); $pdffilename = str_replace('[CURTIME12]',date('gia'), $pdffilename); $pdffilename = str_replace('[CURTIME24]',date('His'), $pdffilename); if (!empty($m)) { $parameter="M".$m; } if (!empty($cat)) { if (!empty($parameter)) {$parameter=$parameter."_"; } $parameter=$parameter."CAT".$cat; } if (!empty($author)) { if (!empty($parameter)) {$parameter=$parameter."_"; } $parameter=$parameter."AUTHOR".$author; } if (!empty($w)) { if (!empty($parameter)) {$parameter=$parameter."_"; } $parameter=$parameter."WEEK".$w; } $pdffilename = str_replace('[PARAMETER]',$parameter, $pdffilename); if ($compress=="true") { $pdf->Output($pdffilename.'.pdf'); gzcompressfile($pdffilename.'.pdf'); header('Location: '.$root_url.'/'.$pdffilename.'.pdf.gz'); exit; } else { $pdf_file = "actualitydotlog-" . date("Ymd-his") . ".pdf"; $pdf->Output("../pdf/$pdf_file"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); //New header("Content-type: application/pdf"); header("Content-Disposition: attachment; filename=\"$pdf_file\""); header('Content-Length: ' . filesize("'../pdf/' . $pdf_file")); header("Pragma: public"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Location: http://emphaticallystatic.org/pdf/$pdf_file"); //header('Cache-Control: maxage=3600'); readfile ($pdf_file); //echo ('It\'s broken. Meh. For now, you can fetch it from here.'); exit; } } else { echo "Sorry, no post matched your criteria."; } # "And in the end, the love you take, is equal to the love you make" ?>