| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/seaside.pacim.de/web/ |
Upload File : |
<?php
/**
* partner-terms.php – Teilnahmebedingungen des Partnerprogramms als professionelles PDF.
* Öffentlich erreichbar (die Bedingungen sind ohnehin einsehbar). Unternehmensdaten
* im Kopf- und Fußbereich. Inhalt = pacim_settings.broker_terms (oder Default).
*
* GET (beliebig) -> PDF-Download (Content-Disposition: attachment)
*/
require_once( __DIR__ . '/includes/config.inc.php' );
@ini_set( 'display_errors', '0' );
error_reporting( 0 );
$company = pacim_company();
$blocks = broker_terms_blocks( broker_terms_text() );
/* ---- FPDF-Subklasse mit gebrandetem Kopf-/Fußbereich ---- */
class TermsPDF extends FPDF {
public $company = array();
public $docTitle = 'Teilnahmebedingungen am Partnerprogramm';
private function enc( $s ) {
$r = @iconv( 'UTF-8', 'windows-1252//TRANSLIT', (string) $s );
return $r === false ? utf8_decode( (string) $s ) : $r;
}
function Header() {
$c = $this->company;
// Brand-Band
$this->SetFillColor( 11, 70, 119 );
$this->Rect( 0, 0, 210, 26, 'F' );
// Firmenname (weiß)
$this->SetTextColor( 255, 255, 255 );
$this->SetFont( 'Arial', 'B', 15 );
$this->SetXY( 15, 7 );
$this->Cell( 120, 7, $this->enc( $c['name'] ), 0, 0, 'L' );
if ( ! empty( $c['suffix'] ) ) {
$this->SetFont( 'Arial', '', 9 );
$this->SetXY( 15, 15 );
$this->Cell( 120, 5, $this->enc( $c['suffix'] ), 0, 0, 'L' );
}
// rechts: Bereich
$this->SetFont( 'Arial', '', 10 );
$this->SetXY( -75, 10 );
$this->Cell( 60, 6, $this->enc( 'Partnerprogramm' ), 0, 0, 'R' );
// Inhalt beginnt unter dem Band
$this->SetY( 36 );
$this->SetTextColor( 0, 0, 0 );
}
function Footer() {
$c = $this->company;
$this->SetY( -24 );
// Trennlinie
$this->SetDrawColor( 210, 214, 220 );
$this->Line( 15, $this->GetY(), 195, $this->GetY() );
$this->Ln( 2 );
$this->SetFont( 'Arial', '', 7 );
$this->SetTextColor( 120, 128, 138 );
$l1 = trim( $c['name'] . ' ' . ( $c['suffix'] ?? '' ) ) . ' · ' . $c['street'] . ' · ' . $c['zip'] . ' ' . $c['city'];
$l2 = 'Tel. ' . $c['phone'] . ' · ' . $c['email'] . ' · ' . $c['web'];
$l3 = $c['court'] . ' ' . $c['hra'] . ' · Steuer-Nr. ' . $c['taxnr'] . ' · ' . $c['bank_name'] . ' · IBAN ' . $c['iban'] . ' · BIC ' . $c['bic'];
foreach ( array( $l1, $l2, $l3 ) as $line ) {
$this->Cell( 0, 3.6, $this->enc( $line ), 0, 1, 'C' );
}
// Seitenzahl
$this->SetY( -10 );
$this->SetFont( 'Arial', '', 7 );
$this->Cell( 0, 4, $this->enc( 'Seite ' . $this->PageNo() . ' von {nb}' ), 0, 0, 'R' );
}
/** Rendert die Bedingungsblöcke. */
function RenderBlocks( $blocks ) {
// Titel
$this->SetFont( 'Arial', 'B', 17 );
$this->SetTextColor( 11, 70, 119 );
$this->MultiCell( 0, 8, $this->enc( $this->docTitle ), 0, 'L' );
$this->SetFont( 'Arial', '', 9 );
$this->SetTextColor( 130, 138, 148 );
$this->Cell( 0, 6, $this->enc( 'Stand: ' . date( 'd.m.Y' ) ), 0, 1, 'L' );
$this->Ln( 3 );
foreach ( $blocks as $b ) {
if ( $b['type'] === 'h' ) {
$this->Ln( 2 );
$this->SetFont( 'Arial', 'B', 11.5 );
$this->SetTextColor( 11, 70, 119 );
$this->MultiCell( 0, 6, $this->enc( $b['text'] ), 0, 'L' );
$this->Ln( 1 );
} else if ( $b['type'] === 'li' ) {
$this->SetFont( 'Arial', '', 10 );
$this->SetTextColor( 45, 51, 61 );
$x = $this->GetX();
// chr(149)=0x95 ist in windows-1252 bereits das Aufzählungszeichen „•".
// NICHT durch enc()/iconv schicken – 0x95 ist kein gültiges UTF-8 und würde zu „?" werden.
$this->Cell( 6, 5.4, chr( 149 ), 0, 0, 'R' );
$this->SetX( $x + 8 );
$this->MultiCell( 182 - 8, 5.4, $this->enc( $b['text'] ), 0, 'J' );
$this->Ln( 1 );
} else {
$this->SetFont( 'Arial', '', 10 );
$this->SetTextColor( 45, 51, 61 );
$this->MultiCell( 0, 5.4, $this->enc( $b['text'] ), 0, 'J' );
$this->Ln( 2.5 );
}
}
}
}
$pdf = new TermsPDF( 'P', 'mm', 'A4' );
$pdf->company = $company;
$pdf->AliasNbPages();
$pdf->SetAutoPageBreak( true, 30 );
$pdf->SetMargins( 15, 36, 15 );
$pdf->AddPage();
$pdf->RenderBlocks( $blocks );
while ( ob_get_level() > 0 ) ob_end_clean();
// inline=1 -> im Browser/iframe anzeigen (Vorschau), sonst Download.
$dest = ( ! empty( $_GET['inline'] ) ) ? 'I' : 'D';
$pdf->Output( $dest, 'Teilnahmebedingungen-Partnerprogramm.pdf' );
exit();