|
- <?php
-
- require('fpdf/fpdf.php');
-
-
- class PDFO6H extends FPDF
- {
- protected $B = 0;
- protected $I = 0;
- protected $U = 0;
- protected $HREF = '';
-
- // Margins
- var $left = 10;
- var $right = 10;
- var $top = 10;
- var $bottom = 10;
-
-
- function WriteHTML($html)
- {
- // Intérprete de HTML
- $html = str_replace("\n",' ',$html);
- $a = preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
- foreach($a as $i=>$e)
- {
- if($i%2==0)
- {
- // Text
- if($this->HREF)
- $this->PutLink($this->HREF,$e);
- else
- $this->Write(5,$e);
- }
- else
- {
- // Etiqueta
- if($e[0]=='/')
- $this->CloseTag(strtoupper(substr($e,1)));
- else
- {
- // Extraer atributos
- $a2 = explode(' ',$e);
- $tag = strtoupper(array_shift($a2));
- $attr = array();
- foreach($a2 as $v)
- {
- if(preg_match('/([^=]*)=["\']?([^"\']*)/',$v,$a3))
- $attr[strtoupper($a3[1])] = $a3[2];
- }
- $this->OpenTag($tag,$attr);
- }
- }
- }
- }
-
- function OpenTag($tag, $attr)
- {
- // Etiqueta de apertura
- if($tag=='B' || $tag=='I' || $tag=='U')
- $this->SetStyle($tag,true);
- if($tag=='A')
- $this->HREF = $attr['HREF'];
- if($tag=='BR')
- $this->Ln(5);
- }
-
- function CloseTag($tag)
- {
- // Etiqueta de cierre
- if($tag=='B' || $tag=='I' || $tag=='U')
- $this->SetStyle($tag,false);
- if($tag=='A')
- $this->HREF = '';
- }
-
- function SetStyle($tag, $enable)
- {
- // Modificar estilo y escoger la fuente correspondiente
- $this->$tag += ($enable ? 1 : -1);
- $style = '';
- foreach(array('B', 'I', 'U') as $s)
- {
- if($this->$s>0)
- $style .= $s;
- }
- $this->SetFont('',$style);
- }
-
- function PutLink($URL, $txt)
- {
- // Escribir un hiper-enlace
- $this->SetTextColor(0,0,255);
- $this->SetStyle('U',true);
- $this->Write(5,$txt,$URL);
- $this->SetStyle('U',false);
- $this->SetTextColor(0);
- }
- function ShadowCell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $color='G', $distance=0.5)
- {
- if($color=='G')
- $ShadowColor = 100;
- elseif($color=='B')
- $ShadowColor = 0;
- else
- $ShadowColor = $color;
- $TextColor = $this->TextColor;
- $x = $this->x;
- $this->SetTextColor($ShadowColor);
- $this->Cell($w, $h, $txt, $border, 0, $align, $fill, $link);
- $this->TextColor = $TextColor;
- $this->x = $x;
- $this->y += $distance;
- $this->Cell($w, $h, $txt, 0, $ln, $align);
- }
-
-
- // Create Table
- function WriteTable($tcolums)
- {
- // go through all colums
- for ($i = 0; $i < sizeof($tcolums); $i++)
- {
- $current_col = $tcolums[$i];
- $height = 0;
-
- // get max height of current col
- $nb=0;
- for($b = 0; $b < sizeof($current_col); $b++)
- {
- // set style
- $this->SetFont($current_col[$b]['font_name'], $current_col[$b]['font_style'], $current_col[$b]['font_size']);
- $color = explode(",", $current_col[$b]['fillcolor']);
- $this->SetFillColor($color[0], $color[1], $color[2]);
- $color = explode(",", $current_col[$b]['textcolor']);
- $this->SetTextColor($color[0], $color[1], $color[2]);
- $color = explode(",", $current_col[$b]['drawcolor']);
- $this->SetDrawColor($color[0], $color[1], $color[2]);
- $this->SetLineWidth($current_col[$b]['linewidth']);
-
- $nb = max($nb, $this->NbLines($current_col[$b]['width'], $current_col[$b]['text']));
- $height = $current_col[$b]['height'];
- }
- $h=$height*$nb;
-
-
- // Issue a page break first if needed
- $this->CheckPageBreak($h);
-
- // Draw the cells of the row
- for($b = 0; $b < sizeof($current_col); $b++)
- {
- $w = $current_col[$b]['width'];
- $a = $current_col[$b]['align'];
-
- // Save the current position
- $x=$this->GetX();
- $y=$this->GetY();
-
- // set style
- $this->SetFont($current_col[$b]['font_name'], $current_col[$b]['font_style'], $current_col[$b]['font_size']);
- $color = explode(",", $current_col[$b]['fillcolor']);
- $this->SetFillColor($color[0], $color[1], $color[2]);
- $color = explode(",", $current_col[$b]['textcolor']);
- $this->SetTextColor($color[0], $color[1], $color[2]);
- $color = explode(",", $current_col[$b]['drawcolor']);
- $this->SetDrawColor($color[0], $color[1], $color[2]);
- $this->SetLineWidth($current_col[$b]['linewidth']);
-
- $color = explode(",", $current_col[$b]['fillcolor']);
- $this->SetDrawColor($color[0], $color[1], $color[2]);
-
-
- // Draw Cell Background
- $this->Rect($x, $y, $w, $h, 'FD');
-
- $color = explode(",", $current_col[$b]['drawcolor']);
- $this->SetDrawColor($color[0], $color[1], $color[2]);
-
- // Draw Cell Border
- if (substr_count($current_col[$b]['linearea'], "T") > 0)
- {
- $this->Line($x, $y, $x+$w, $y);
- }
-
- if (substr_count($current_col[$b]['linearea'], "B") > 0)
- {
- $this->Line($x, $y+$h, $x+$w, $y+$h);
- }
-
- if (substr_count($current_col[$b]['linearea'], "L") > 0)
- {
- $this->Line($x, $y, $x, $y+$h);
- }
-
- if (substr_count($current_col[$b]['linearea'], "R") > 0)
- {
- $this->Line($x+$w, $y, $x+$w, $y+$h);
- }
-
-
- // Print the text
- $this->MultiCell($w, $current_col[$b]['height'], $current_col[$b]['text'], 0, $a, 0);
-
- // Put the position to the right of the cell
- $this->SetXY($x+$w, $y);
- }
-
- // Go to the next line
- $this->Ln($h);
- }
- }
-
-
- // If the height h would cause an overflow, add a new page immediately
- function CheckPageBreak($h)
- {
- if($this->GetY()+$h>$this->PageBreakTrigger)
- $this->AddPage($this->CurOrientation);
- }
-
-
- // Computes the number of lines a MultiCell of width w will take
- function NbLines($w, $txt)
- {
- $cw=&$this->CurrentFont['cw'];
- if($w==0)
- $w=$this->w-$this->rMargin-$this->x;
- $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
- $s=str_replace("\r", '', $txt);
- $nb=strlen($s);
- if($nb>0 and $s[$nb-1]=="\n")
- $nb--;
- $sep=-1;
- $i=0;
- $j=0;
- $l=0;
- $nl=1;
- while($i<$nb)
- {
- $c=$s[$i];
- if($c=="\n")
- {
- $i++;
- $sep=-1;
- $j=$i;
- $l=0;
- $nl++;
- continue;
- }
- if($c==' ')
- $sep=$i;
- $l+=$cw[$c];
- if($l>$wmax)
- {
- if($sep==-1)
- {
- if($i==$j)
- $i++;
- }
- else
- $i=$sep+1;
- $sep=-1;
- $j=$i;
- $l=0;
- $nl++;
- }
- else
- $i++;
- }
- return $nl;
- }
- }
-
-
- //$name = $_POST['name'];
- $info = $_POST['pdf_power2'];
- $nombre_bd = $_POST['nombre_bd2'];
- $usuario_bd = $_POST['usuario_bd2'];
- $pass_bd = $_POST['pass_bd2'];
- $nombreDominio = $_POST['dominio_nuevo'];
- $usuario_ftp = $_POST['usuario_ftp2'];
- $pass_ftp = $_POST['pass_ftp2'];
-
- //$nombre_base = $_POST['nombre_bd'];
- //$info=$_GET['datos_pdf'];
- $acentuar = 'Politica';
- //$str = utf8_decode($str);
- $enlace = '<br><a href="http://www.open6hosting.com">www.open6hosting.com</a>';
- $enlaceBlog = '<br><a href="http://www.open6hosting.com/blog">Blog</a>';
- $enlaceFace = '<br><a href="http://www.facebook.com/open6hosting">Facebook</a>';
- $enlaceTwitter = '<br><a href="http://www.twitter.com/Open6Hosting">Twitter</a>';
- $enlacePriv = '<br><a href="http://www.open6hosting.com/empresa/legales">'.$acentuar.' de privacidad</a>';
- $enlaceAdvertencia = '<br><a href="http://www.open6hosting.com/lopd.html">Advertencia legal</a>';
- $enlaceMail = '<br><a href="info@open6hosting.com">info@open6hosting.com</a>';
-
- $hoy = date("d-m-Y H:i:s");
-
-
- //print 'en creacion: ' . $nombre_bd . ' ' . $usuario_bd . ' ' . $pass_bd;
- $pdf = new PDFO6H();
- // Primera página
- $pdf->AddPage();
- //Uso un ttf con caracteres españoles
- //$pdf->AddFont('ArialNarrow','','arial-narrow.php');
- $pdf->SetFont('Arial','',28);
- //$pdf->Write(5,'Para saber qué hay de nuevo en este tutorial, pulse ');
- $pdf->SetFont('','U');
- //$link = $pdf->AddLink();
- //$pdf->Write(5,'aquí',$link);
- $pdf->SetFont('');
- $pdf->SetTextColor(0, 200, 100);
- $Text = sprintf($_POST['dominio_nuevo'], 0.5);
- $pdf->ShadowCell(0, 80, $Text, 1, 1, 'C', false, '', 'B', 0.5);
- $pdf->SetTextColor(0, 0, 0);
-
- $pdf->AliasNbPages();
- $pdf->SetMargins($pdf->left, $pdf->top, $pdf->right);
- //$pdf->AddPage();
-
- $pdf->WriteHTML('<br><br><br><br>');
- // create table
- $columns = array();
-
- // header tupla
- $col = array();
- $col[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '255,255,255', 'linewidth' => '0.0', 'linearea' => '');
- $col[] = array('text' => 'BBDD', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '15', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
- $col[] = array('text' => '', 'width' => '140', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '15', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
- $columns[] = $col;
- //color guapo para fondo '135,206,250'
- // data tupla 1
- $col = array();
- $col[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
- $col[] = array('text' => 'Nombre:', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
- $col[] = array('text' => $nombre_bd, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
- $columns[] = $col;
-
- // data tupla 2
- $col = array();
- $col[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
- $col[] = array('text' => 'Usuario:', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
- $col[] = array('text' => $usuario_bd, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
- $columns[] = $col;
-
- // data tupla 3
- $col = array();
- $col[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
- $col[] = array('text' => 'Clave:', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
- $col[] = array('text' => $pass_bd, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
- $columns[] = $col;
-
- // Draw Table
- $pdf->WriteTable($columns);
- $pdf->WriteHTML('<br>');
- // header tupla 2
- $col2 = array();
- $col2[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '255,255,255', 'linewidth' => '0.0', 'linearea' => '');
- $col2[] = array('text' => 'FTP', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '15', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
- $col2[] = array('text' => '', 'width' => '140', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '15', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
- $columns2[] = $col2;
-
- // data tupla 1
- $col2 = array();
- $col2[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
- $col2[] = array('text' => 'Usuario:', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
- $col2[] = array('text' => $usuario_ftp, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
- $columns2[] = $col2;
-
- // data tupla 2
- $col2 = array();
- $col2[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
- $col2[] = array('text' => 'Clave:', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
- $col2[] = array('text' => $pass_ftp, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => '');
- $columns2[] = $col2;
-
-
- $pdf->WriteHTML('<br>');
- $pdf->WriteTable($columns2);
-
- // header 3
- $col3 = array();
- $col3[] = array('text' => '', 'width' => '10', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '255,255,255', 'linewidth' => '0.0', 'linearea' => '');
- $col3[] = array('text' => 'Nuevo Dominio:', 'width' => '40', 'height' => '7', 'align' => 'R', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => '', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
- $col3[] = array('text' => $nombreDominio, 'width' => '140', 'height' => '7', 'align' => 'L', 'font_name' => 'Arial', 'font_size' => '13', 'font_style' => 'B', 'fillcolor' => '255,255,255', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.0', 'linearea' => '');
- $columns3[] = $col3;
-
- $pdf->WriteHTML('<br><br>');
- // Draw Table
- $pdf->WriteTable($columns3);
-
-
-
- //$pdf->AddPage();
- $pdf->SetLink($link);
- $pdf->Image('imagen/open6-logo.png',10,12,50,0,'','http://www.open6hosting.com');
- $pdf->SetLeftMargin(12);
- $pdf->SetFontSize(10);
- $pdf->WriteHTML('<br><br><br><br><br><br>');
-
-
- //$pdf->WriteHTML($name);
- //$pdf->WriteHTML($info);
- $pdf->WriteHTML($enlace);
- $pdf->WriteHTML('<b></b><br>Telf: 951 20 42 88 <br>');
- $pdf->WriteHTML('<b></b>Fax: 951 39 09 29');
- //$pdf->WriteHTML($enlace);
- $pdf->WriteHTML($enlaceBlog);
- $pdf->WriteHTML($enlaceFace);
- $pdf->WriteHTML($enlaceTwitter);
- $pdf->WriteHTML('<br>');
- $pdf->WriteHTML($enlacePriv);
- $pdf->WriteHTML($enlaceAdvertencia);
- //$pdf->WriteHTML($nombre_base);
- $pdf->Output();
-
- //header('Location: http://www.open6hosting.com');
- ?>
|