403Webshell
Server IP : 104.21.21.239  /  Your IP : 216.73.216.25
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/hotel-dev/public_html/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/hotel-dev/public_html/classes//lcs_db_report_doc.php
<?php
use PhpOffice\PhpWord\Settings;

class lcs_db_report_doc extends lcs_db_report_base implements report_interface {
	
	protected $phpWord;
	protected $section;
	protected $table;
	protected $cell;
	protected $textrun;
	protected $header;
	protected $footer;
	protected $sectionStyleP = [
		'orientation' => 'portrait',
		'pageSizeW' => 8.5 * 1440,
		'pageSizeH' => 11 * 1440,
		'marginTop' => 0.5 * 1440,
		'marginBottom' => 0.5 * 1440,
		'marginLeft' => 0.4 * 1440,
		'marginRight' => 0.4 * 1440,
	];
	protected $sectionStyleL = [
		'orientation' => 'landscape',
		'pageSizeW' => 11 * 1440,
		'pageSizeH' => 8.5 * 1440,
		'marginTop' => 0.4 * 1440,
		'marginBottom' => 0.4 * 1440,
		'marginLeft' => 0.5 * 1440,
		'marginRight' => 0.5 * 1440,
	];
	protected $tableStyle = [
		//'cellMarginLeft' => $cell_margin_left * 1440,
		//'borderSize' => 0,
	];
	protected $cellStyle = [
		'valign' => 'top',
	];
	protected $paragraphStyle = ['align' => 'left'];
	protected $paragraphStyleHeader = ['align' => 'center'];
	protected $fontStyle = ['name' => 'Arial', 'size' => 10, 'bold' => false, ];
	protected $fontStyleHeader = ['name' => 'Arial', 'size' => 10, 'bold' => true, ];
	
	public function __construct() {
		Settings::loadConfig();
		$this->phpWord = new \PhpOffice\PhpWord\PhpWord();
	}
	
	public function report_start()
	{
		$this->phpWord->addParagraphStyle('pStyle', $this->paragraphStyle);
		$this->section = $this->phpWord->addSection($this->{'sectionStyle'.$_POST['orientation']});
		//$section->addText('Hello World!');
		$section_style = $this->section->getStyle();
		$position =	$section_style->getPageSizeW() - $section_style->getMarginRight() - $section_style->getMarginLeft();
		$this->phpWord->addParagraphStyle("leftRight", array("tabs" => [
			new \PhpOffice\PhpWord\Style\Tab("center", $position / 2),
			new \PhpOffice\PhpWord\Style\Tab("right", $position),
		]));		
		$this->header = $this->section->addHeader();
		$this->header->addText('Davler Media Group'."\t".'Master Hotel Database'."\t", [], 'leftRight');
		$this->header->addText("\t".htmlspecialchars($this->get_report_title()), ['size' => 14, 'bold' => true, ], 'leftRight');
		$this->footer = $this->section->addFooter();
		$this->footer->addPreserveText(date('m/d/Y')."\t".'{PAGE}'."\t".'User: '.$_SESSION['user_full_name'], [], 'leftRight');
		$this->table = $this->section->addTable($this->tableStyle);
	}

	public function report_end()
	{
	}

	public function header_start()
	{
	}

	public function header_end()
	{
	}

	public function header_row_start()
	{
		$this->table->addRow();
	}

	public function header_row_end()
	{
	}

	public function header_cell_add($data = '', $args = [])
	{
		$this->format_cell($data, $args, $this->paragraphStyleHeader, $this->fontStyleHeader);
	}

	public function footer_start()
	{
	}

	public function footer_end()
	{
	}

	public function footer_row_start()
	{
		$this->table->addRow();
	}

	public function footer_row_end()
	{
	}

	public function footer_cell_add($data = '', $args = [])
	{
		$this->format_cell($data, $args, $this->paragraphStyle, $this->fontStyle);
	}

	public function data_start()
	{
	}

	public function data_end()
	{
	}

	public function data_row_start()
	{
		$this->table->addRow();
	}

	public function data_row_end()
	{
	}

	public function data_cell_add($data = '', $args = [])
	{
		$this->format_cell($data, $args, $this->paragraphStyle, $this->fontStyle);
	}

	public function output_report($filename = '')
	{
		$file = 'Report.docx';
		$writer = 'Word2007';
		$content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
		header("Content-Description: File Transfer");
		header('Content-Disposition: attachment; filename="' . $file . '"');
		header('Content-Type: '.$content_type);
		header('Content-Transfer-Encoding: binary');
		header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
		header('Expires: 0');
		$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($this->phpWord, $writer);
		$xmlWriter->save("php://output");
	}
	
	private function format_cell($data, $args, $par_style, $font_style)
	{
		$attr = '';
		$width = 1.5;
		$colspan = 1;
		foreach ($args as $key => $value) :
			$attr .= ' '.$key.'="'.$value.'"';
			switch ($key) :
				case 'width' :
					$width = floatval($value) / 96;
					break;
				case 'colspan' :
					$colspan = intval($value);
					break;
				case 'align' :
					$par_style['align'] = $value;
					break;
			endswitch;
		endforeach;
		$this->cell = $this->table->addCell($width * 1440, $this->cellStyle);
		if ($colspan > 1) :
			$this->cell->getStyle()->setGridSpan($colspan);
		endif;
		$data = str_ireplace('<br />', '<br>', $data);
		$ar_data = explode('<br>', $data);
		$ar_data = array_map('trim', $ar_data);
		$arlen = count($ar_data);
		$i = 0;
		$this->textrun = $this->cell->addTextRun($par_style);
		foreach($ar_data as $value) :
			$i++;
			$this->textrun->addText(htmlspecialchars($value), $font_style);
			if ($i < $arlen) :
				$this->textrun->addTextBreak();
			endif;
		endforeach;
	}
	
}

Youez - 2016 - github.com/yon3zu
LinuXploit