芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/clients/canaldegap.fr/modules/Printing/action.output.php
GetConfig(); $url = base64_decode($params['url']); $pageid = (int)$params['pageid']; $pdf = (int)$params['pdf']; $pdf = $pdf && $this->GetPreference('pdfenable'); $script = (int)$params['script']; $includetemplate = (int)$params['includetemplate']; // get the output content. $showcontent = ''; if( startswith($url,$config['root_url']) ) { $showcontent = $this->GetURLContent($url); if (isset($_REQUEST["includetemplate"]) && $_REQUEST["includetemplate"]=="true") { $showcontent=$this->GetBody($showcontent); } } $contentops =& $gCms->GetContentOperations(); $content =& $contentops->LoadContentFromId($pageid); $title = $content->Name(); $templateid = $content->TemplateId(); $menutext = $content->MenuText(); $this->smarty->assign("title",$title); $this->smarty->assign("content", $showcontent); $this->smarty->assign("url", $url); $encoding=$config['default_encoding']; // kill any output that may have happened already. $handlers = ob_list_handlers(); for ($cnt = 0; $cnt < sizeof($handlers); $cnt++) { ob_end_clean(); } if ($pdf) { $pdfhtml=$this->ProcessTemplateFromDatabase("pdftemplate"); $pdfhtml=str_replace("\t"," ",$pdfhtml); $pdfhtml=str_replace("\r"," ",$pdfhtml); $pdfhtml=str_replace("\n"," ",$pdfhtml); while (strpos($pdfhtml,' ') !== false) $pdfhtml= str_replace(' ',' ',$pdfhtml); $pdfhtml=$this->relativeToAbsolute($config["root_url"],$pdfhtml); require_once(dirname(__FILE__).'/tcpdf/tcpdf.php'); $fontname=$this->GetPreference("fonttype","freesans"); //echo $fontname; $pdf = new TCPDF($this->GetPreference("orientation","P"), PDF_UNIT, PDF_PAGE_FORMAT, true,$encoding); $pdf->SetHeaderData("", "", $title, $this->GetPreference("pdfheader","Generated by CMS Made Simple")); //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->setHeaderFont(Array($fontname, '', $this->GetPreference("headerfontsize","10"))); $pdf->setFooterFont(Array($fontname, '', $this->GetPreference("headerfontsize","10"))); $pdf->setFont($fontname, '', $this->GetPreference("contentfontsize","10")); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->writeHTML($pdfhtml, true, 0); @ob_clean(); $pdf->Output($menutext.".pdf","D"); } else { //Printing-specific assignments $smarty->assign("templateid", $templateid); $smarty->assign("overridestylesheet", $this->GetPreference("overridestyle")); $smarty->assign("encoding", $encoding); $smarty->assign("rooturl", $config["root_url"]."/"); if ($script) { $smarty->assign("printscript", ''); } else { $smarty->assign("printscript", ''); } echo $this->ProcessTemplateFromDatabase("printtemplate"); } exit;