ISPConfig module for simplify the creation of websites and DNS zones in a only step
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

149 wiersze
3.8 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. function WriteHTML($html)
  10. {
  11. // Intérprete de HTML
  12. $html = str_replace("\n",' ',$html);
  13. $a = preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
  14. foreach($a as $i=>$e)
  15. {
  16. if($i%2==0)
  17. {
  18. // Text
  19. if($this->HREF)
  20. $this->PutLink($this->HREF,$e);
  21. else
  22. $this->Write(5,$e);
  23. }
  24. else
  25. {
  26. // Etiqueta
  27. if($e[0]=='/')
  28. $this->CloseTag(strtoupper(substr($e,1)));
  29. else
  30. {
  31. // Extraer atributos
  32. $a2 = explode(' ',$e);
  33. $tag = strtoupper(array_shift($a2));
  34. $attr = array();
  35. foreach($a2 as $v)
  36. {
  37. if(preg_match('/([^=]*)=["\']?([^"\']*)/',$v,$a3))
  38. $attr[strtoupper($a3[1])] = $a3[2];
  39. }
  40. $this->OpenTag($tag,$attr);
  41. }
  42. }
  43. }
  44. }
  45. function OpenTag($tag, $attr)
  46. {
  47. // Etiqueta de apertura
  48. if($tag=='B' || $tag=='I' || $tag=='U')
  49. $this->SetStyle($tag,true);
  50. if($tag=='A')
  51. $this->HREF = $attr['HREF'];
  52. if($tag=='BR')
  53. $this->Ln(5);
  54. }
  55. function CloseTag($tag)
  56. {
  57. // Etiqueta de cierre
  58. if($tag=='B' || $tag=='I' || $tag=='U')
  59. $this->SetStyle($tag,false);
  60. if($tag=='A')
  61. $this->HREF = '';
  62. }
  63. function SetStyle($tag, $enable)
  64. {
  65. // Modificar estilo y escoger la fuente correspondiente
  66. $this->$tag += ($enable ? 1 : -1);
  67. $style = '';
  68. foreach(array('B', 'I', 'U') as $s)
  69. {
  70. if($this->$s>0)
  71. $style .= $s;
  72. }
  73. $this->SetFont('',$style);
  74. }
  75. function PutLink($URL, $txt)
  76. {
  77. // Escribir un hiper-enlace
  78. $this->SetTextColor(0,0,255);
  79. $this->SetStyle('U',true);
  80. $this->Write(5,$txt,$URL);
  81. $this->SetStyle('U',false);
  82. $this->SetTextColor(0);
  83. }
  84. }
  85. $info = $_POST['pdf_power'];
  86. //echo "La información en directorio ispconfig: ".$info;
  87. echo '<form method="post" id="formulario" id="fuera" action="crear_pdf_o6h.php">';
  88. echo '<input id="pdf_power2" name="pdf_power2" type="hidden" value="'.$info.'">';
  89. //echo '<input id="pulsame" type="submit" value="FueraPDF">';
  90. /*echo '<a href="webdns/pdf_o6h.php" target="_blank" onclick="window.open(this.href, this.target,
  91. "width=400, hight=150, top=200, toolbar=no, status=no, menubar=no");return false;"><img src="imagen/open6-logo.png"></img>FueraPDF</a>';
  92. */
  93. echo '</form>';
  94. echo '<script type="text/javascript">';
  95. //echo 'alert(document.getElementById("pdf_power2").value);';
  96. echo 'var vamos = document.getElementById("formulario").submit();';
  97. //echo 'var vamos = document.getElementById("formulario");';
  98. //echo 'vamos.href ="crear_pdf_o6h.php";';
  99. //echo 'window.open();';
  100. //echo 'vamos.target() = "_blank";';
  101. //echo 'vamos.submit();';
  102. //echo 'vamos.target ="_blank";';
  103. //echo '$('#fuera').submit();';
  104. //echo 'document.fuera.submit();';
  105. echo '</script>';
  106. //echo $info;
  107. //header('Location: crear_pdf_o6h.php');
  108. /*
  109. ?>
  110. <script type="text/javascript">
  111. jQuery('#pulsame').click(function() {
  112. //$("#pdf_power").val("1");
  113. alert(document.getElementById("pdf_power2").value);
  114. //ISPConfig.submitForm('formulario','webdns/pdf_o6h.php');
  115. //w = window.open('webdns/pdf_o6h.php');
  116. //w.document.open();
  117. //w.document.write($html_resultado);
  118. //w.document.write(document.getElementById("pdf_power").value);
  119. //w.document.close();
  120. });
  121. document.getElementById("fuera").submit();
  122. //$('#fuera').submit();
  123. /*function crearElPdf(url) {
  124. alert ("Esto es javascript");
  125. window.open(url, "nuevo", "directories=no, location=no, menubar=no, scrollbars=yes, statusbar=no, tittlebar=no, width=400, height=400");
  126. }*/
  127. /*</script>*/