ISPConfig module for simplify the creation of websites and DNS zones in a only step
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

415 行
17 KiB

  1. <?php
  2. require('fpdf/fpdf.php');
  3. class PDFO6H extends FPDF
  4. {
  5. protected $B = 0;
  6. protected $I = 0;
  7. protected $U = 0;
  8. protected $HREF = '';
  9. // Margins
  10. var $left = 10;
  11. var $right = 10;
  12. var $top = 10;
  13. var $bottom = 10;
  14. function WriteHTML($html)
  15. {
  16. // Intérprete de HTML
  17. $html = str_replace("\n",' ',$html);
  18. $a = preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
  19. foreach($a as $i=>$e)
  20. {
  21. if($i%2==0)
  22. {
  23. // Text
  24. if($this->HREF)
  25. $this->PutLink($this->HREF,$e);
  26. else
  27. $this->Write(5,$e);
  28. }
  29. else
  30. {
  31. // Etiqueta
  32. if($e[0]=='/')
  33. $this->CloseTag(strtoupper(substr($e,1)));
  34. else
  35. {
  36. // Extraer atributos
  37. $a2 = explode(' ',$e);
  38. $tag = strtoupper(array_shift($a2));
  39. $attr = array();
  40. foreach($a2 as $v)
  41. {
  42. if(preg_match('/([^=]*)=["\']?([^"\']*)/',$v,$a3))
  43. $attr[strtoupper($a3[1])] = $a3[2];
  44. }
  45. $this->OpenTag($tag,$attr);
  46. }
  47. }
  48. }
  49. }
  50. function OpenTag($tag, $attr)
  51. {
  52. // Etiqueta de apertura
  53. if($tag=='B' || $tag=='I' || $tag=='U')
  54. $this->SetStyle($tag,true);
  55. if($tag=='A')
  56. $this->HREF = $attr['HREF'];
  57. if($tag=='BR')
  58. $this->Ln(5);
  59. }
  60. function CloseTag($tag)
  61. {
  62. // Etiqueta de cierre
  63. if($tag=='B' || $tag=='I' || $tag=='U')
  64. $this->SetStyle($tag,false);
  65. if($tag=='A')
  66. $this->HREF = '';
  67. }
  68. function SetStyle($tag, $enable)
  69. {
  70. // Modificar estilo y escoger la fuente correspondiente
  71. $this->$tag += ($enable ? 1 : -1);
  72. $style = '';
  73. foreach(array('B', 'I', 'U') as $s)
  74. {
  75. if($this->$s>0)
  76. $style .= $s;
  77. }
  78. $this->SetFont('',$style);
  79. }
  80. function PutLink($URL, $txt)
  81. {
  82. // Escribir un hiper-enlace
  83. $this->SetTextColor(0,0,255);
  84. $this->SetStyle('U',true);
  85. $this->Write(5,$txt,$URL);
  86. $this->SetStyle('U',false);
  87. $this->SetTextColor(0);
  88. }
  89. function ShadowCell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $color='G', $distance=0.5)
  90. {
  91. if($color=='G')
  92. $ShadowColor = 100;
  93. elseif($color=='B')
  94. $ShadowColor = 0;
  95. else
  96. $ShadowColor = $color;
  97. $TextColor = $this->TextColor;
  98. $x = $this->x;
  99. $this->SetTextColor($ShadowColor);
  100. $this->Cell($w, $h, $txt, $border, 0, $align, $fill, $link);
  101. $this->TextColor = $TextColor;
  102. $this->x = $x;
  103. $this->y += $distance;
  104. $this->Cell($w, $h, $txt, 0, $ln, $align);
  105. }
  106. // Create Table
  107. function WriteTable($tcolums)
  108. {
  109. // go through all colums
  110. for ($i = 0; $i < sizeof($tcolums); $i++)
  111. {
  112. $current_col = $tcolums[$i];
  113. $height = 0;
  114. // get max height of current col
  115. $nb=0;
  116. for($b = 0; $b < sizeof($current_col); $b++)
  117. {
  118. // set style
  119. $this->SetFont($current_col[$b]['font_name'], $current_col[$b]['font_style'], $current_col[$b]['font_size']);
  120. $color = explode(",", $current_col[$b]['fillcolor']);
  121. $this->SetFillColor($color[0], $color[1], $color[2]);
  122. $color = explode(",", $current_col[$b]['textcolor']);
  123. $this->SetTextColor($color[0], $color[1], $color[2]);
  124. $color = explode(",", $current_col[$b]['drawcolor']);
  125. $this->SetDrawColor($color[0], $color[1], $color[2]);
  126. $this->SetLineWidth($current_col[$b]['linewidth']);
  127. $nb = max($nb, $this->NbLines($current_col[$b]['width'], $current_col[$b]['text']));
  128. $height = $current_col[$b]['height'];
  129. }
  130. $h=$height*$nb;
  131. // Issue a page break first if needed
  132. $this->CheckPageBreak($h);
  133. // Draw the cells of the row
  134. for($b = 0; $b < sizeof($current_col); $b++)
  135. {
  136. $w = $current_col[$b]['width'];
  137. $a = $current_col[$b]['align'];
  138. // Save the current position
  139. $x=$this->GetX();
  140. $y=$this->GetY();
  141. // set style
  142. $this->SetFont($current_col[$b]['font_name'], $current_col[$b]['font_style'], $current_col[$b]['font_size']);
  143. $color = explode(",", $current_col[$b]['fillcolor']);
  144. $this->SetFillColor($color[0], $color[1], $color[2]);
  145. $color = explode(",", $current_col[$b]['textcolor']);
  146. $this->SetTextColor($color[0], $color[1], $color[2]);
  147. $color = explode(",", $current_col[$b]['drawcolor']);
  148. $this->SetDrawColor($color[0], $color[1], $color[2]);
  149. $this->SetLineWidth($current_col[$b]['linewidth']);
  150. $color = explode(",", $current_col[$b]['fillcolor']);
  151. $this->SetDrawColor($color[0], $color[1], $color[2]);
  152. // Draw Cell Background
  153. $this->Rect($x, $y, $w, $h, 'FD');
  154. $color = explode(",", $current_col[$b]['drawcolor']);
  155. $this->SetDrawColor($color[0], $color[1], $color[2]);
  156. // Draw Cell Border
  157. if (substr_count($current_col[$b]['linearea'], "T") > 0)
  158. {
  159. $this->Line($x, $y, $x+$w, $y);
  160. }
  161. if (substr_count($current_col[$b]['linearea'], "B") > 0)
  162. {
  163. $this->Line($x, $y+$h, $x+$w, $y+$h);
  164. }
  165. if (substr_count($current_col[$b]['linearea'], "L") > 0)
  166. {
  167. $this->Line($x, $y, $x, $y+$h);
  168. }
  169. if (substr_count($current_col[$b]['linearea'], "R") > 0)
  170. {
  171. $this->Line($x+$w, $y, $x+$w, $y+$h);
  172. }
  173. // Print the text
  174. $this->MultiCell($w, $current_col[$b]['height'], $current_col[$b]['text'], 0, $a, 0);
  175. // Put the position to the right of the cell
  176. $this->SetXY($x+$w, $y);
  177. }
  178. // Go to the next line
  179. $this->Ln($h);
  180. }
  181. }
  182. // If the height h would cause an overflow, add a new page immediately
  183. function CheckPageBreak($h)
  184. {
  185. if($this->GetY()+$h>$this->PageBreakTrigger)
  186. $this->AddPage($this->CurOrientation);
  187. }
  188. // Computes the number of lines a MultiCell of width w will take
  189. function NbLines($w, $txt)
  190. {
  191. $cw=&$this->CurrentFont['cw'];
  192. if($w==0)
  193. $w=$this->w-$this->rMargin-$this->x;
  194. $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
  195. $s=str_replace("\r", '', $txt);
  196. $nb=strlen($s);
  197. if($nb>0 and $s[$nb-1]=="\n")
  198. $nb--;
  199. $sep=-1;
  200. $i=0;
  201. $j=0;
  202. $l=0;
  203. $nl=1;
  204. while($i<$nb)
  205. {
  206. $c=$s[$i];
  207. if($c=="\n")
  208. {
  209. $i++;
  210. $sep=-1;
  211. $j=$i;
  212. $l=0;
  213. $nl++;
  214. continue;
  215. }
  216. if($c==' ')
  217. $sep=$i;
  218. $l+=$cw[$c];
  219. if($l>$wmax)
  220. {
  221. if($sep==-1)
  222. {
  223. if($i==$j)
  224. $i++;
  225. }
  226. else
  227. $i=$sep+1;
  228. $sep=-1;
  229. $j=$i;
  230. $l=0;
  231. $nl++;
  232. }
  233. else
  234. $i++;
  235. }
  236. return $nl;
  237. }
  238. }
  239. //$name = $_POST['name'];
  240. $info = $_POST['pdf_power2'];
  241. $nombre_bd = $_POST['nombre_bd2'];
  242. $usuario_bd = $_POST['usuario_bd2'];
  243. $pass_bd = $_POST['pass_bd2'];
  244. $nombreDominio = $_POST['dominio_nuevo'];
  245. $usuario_ftp = $_POST['usuario_ftp2'];
  246. $pass_ftp = $_POST['pass_ftp2'];
  247. //$nombre_base = $_POST['nombre_bd'];
  248. //$info=$_GET['datos_pdf'];
  249. $enlace = '<br><a href="http://www.open6hosting.com">www.open6hosting.com</a>';
  250. $enlaceBlog = '<br><a href="http://www.open6hosting.com/blog">Blog</a>';
  251. $enlaceFace = '<br><a href="http://www.facebook.com/open6hosting">Facebook</a>';
  252. $enlaceTwitter = '<br><a href="http://www.twitter.com/Open6Hosting">Twitter</a>';
  253. $enlacePriv = '<br><a href="http://www.open6hosting.com/empresa/legales">Politica de privacidad</a>';
  254. $enlaceAdvertencia = '<br><a href="http://www.open6hosting.com/lopd.html">Advertencia legal</a>';
  255. $enlaceMail = '<br><a href="info@open6hosting.com">info@open6hosting.com</a>';
  256. $hoy = date("d-m-Y H:i:s");
  257. //print 'en creacion: ' . $nombre_bd . ' ' . $usuario_bd . ' ' . $pass_bd;
  258. $pdf = new PDFO6H();
  259. // Primera página
  260. $pdf->AddPage();
  261. $pdf->SetFont('Arial','',28);
  262. //$pdf->Write(5,'Para saber qué hay de nuevo en este tutorial, pulse ');
  263. $pdf->SetFont('','U');
  264. //$link = $pdf->AddLink();
  265. //$pdf->Write(5,'aquí­',$link);
  266. $pdf->SetFont('');
  267. $pdf->SetTextColor(0, 200, 100);
  268. $Text = sprintf($_POST['dominio_nuevo'], 0.5);
  269. $pdf->ShadowCell(0, 80, $Text, 1, 1, 'C', false, '', 'B', 0.5);
  270. $pdf->SetTextColor(0, 0, 0);
  271. $pdf->AliasNbPages();
  272. $pdf->SetMargins($pdf->left, $pdf->top, $pdf->right);
  273. //$pdf->AddPage();
  274. $pdf->WriteHTML('<br><br><br><br>');
  275. // create table
  276. $columns = array();
  277. // header tupla
  278. $col = array();
  279. $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' => '');
  280. $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' => '');
  281. $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' => '');
  282. $columns[] = $col;
  283. //color guapo para fondo '135,206,250'
  284. // data tupla 1
  285. $col = array();
  286. $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' => '');
  287. $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' => '');
  288. $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' => '');
  289. $columns[] = $col;
  290. // data tupla 2
  291. $col = array();
  292. $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' => '');
  293. $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' => '');
  294. $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' => '');
  295. $columns[] = $col;
  296. // data tupla 3
  297. $col = array();
  298. $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' => '');
  299. $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' => '');
  300. $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' => '');
  301. $columns[] = $col;
  302. // Draw Table
  303. $pdf->WriteTable($columns);
  304. $pdf->WriteHTML('<br>');
  305. // header tupla 2
  306. $col2 = array();
  307. $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' => '');
  308. $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' => '');
  309. $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' => '');
  310. $columns2[] = $col2;
  311. // data tupla 1
  312. $col2 = array();
  313. $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' => '');
  314. $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' => '');
  315. $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' => '');
  316. $columns2[] = $col2;
  317. // data tupla 2
  318. $col2 = array();
  319. $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' => '');
  320. $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' => '');
  321. $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' => '');
  322. $columns2[] = $col2;
  323. $pdf->WriteHTML('<br>');
  324. $pdf->WriteTable($columns2);
  325. // header 3
  326. $col3 = array();
  327. $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' => '');
  328. $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' => '');
  329. $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' => '');
  330. $columns3[] = $col3;
  331. $pdf->WriteHTML('<br><br>');
  332. // Draw Table
  333. $pdf->WriteTable($columns3);
  334. //$pdf->AddPage();
  335. $pdf->SetLink($link);
  336. $pdf->Image('imagen/open6-logo.png',10,12,50,0,'','http://www.open6hosting.com');
  337. $pdf->SetLeftMargin(12);
  338. $pdf->SetFontSize(10);
  339. $pdf->WriteHTML('<br><br><br><br><br><br>');
  340. //$pdf->WriteHTML($name);
  341. //$pdf->WriteHTML($info);
  342. $pdf->WriteHTML($enlace);
  343. $pdf->WriteHTML('<b></b><br>Telf: 951 20 42 88 <br>');
  344. $pdf->WriteHTML('<b></b>Fax: 951 39 09 29');
  345. //$pdf->WriteHTML($enlace);
  346. $pdf->WriteHTML($enlaceBlog);
  347. $pdf->WriteHTML($enlaceFace);
  348. $pdf->WriteHTML($enlaceTwitter);
  349. $pdf->WriteHTML('<br>');
  350. $pdf->WriteHTML($enlacePriv);
  351. $pdf->WriteHTML($enlaceAdvertencia);
  352. //$pdf->WriteHTML($nombre_base);
  353. $pdf->Output();
  354. //header('Location: http://www.open6hosting.com');
  355. ?>