Procházet zdrojové kódy

Solucionado problema de creación física de la base de datos. Primera versión del pdf.

master
root před 8 roky
rodič
revize
882a717e19
5 změnil soubory, kde provedl 643 přidání a 172 odebrání
  1. +232
    -22
      crear_pdf_o6h.php
  2. +364
    -0
      fpdf/htmlparser.inc
  3. +3
    -3
      lib/module.conf.php
  4. +31
    -11
      new_service_webdns.php
  5. +13
    -136
      pdf_o6h.php

+ 232
- 22
crear_pdf_o6h.php Zobrazit soubor

@@ -10,10 +10,16 @@ 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
// Intérprete de HTML
$html = str_replace("\n",' ',$html);
$a = preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
foreach($a as $i=>$e)
@@ -90,50 +96,254 @@ function PutLink($URL, $txt)
$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);
}

/*if($_POST['id']){
//$app->tform->errorMessage = 'DUMMY';
//$app->tpl->setVar($this->dataRecord);
//$this->onShow();
//return;
echo 'dentro de crear pdf';
}*/
/*$info=$_POST['crear_pdf'];
echo 'La info '.$info;
if($_POST['crear_pdf'])
{
echo 'dentro';
$info=$_POST['crear_pdf'];
}*/
// 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'];

//$name = $_POST['name'];
$info = $_POST['pdf_power2'];
$nombreDominio = $_POST['dominio_nuevo'];
//$nombre_base = $_POST['nombre_bd'];
//$info=$_GET['datos_pdf'];
$enlace = '<br><a href="http://www.open6hosting.com">www.open6hosting.com</a>';

$hoy = date("d-m-Y H:i:s");

$pdf = new PDFO6H();
// Primera página
$pdf->AddPage();
$pdf->SetFont('Arial','',20);
$pdf->SetFont('Arial','',32);
//$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->Write(5,'aquí­',$link);
$pdf->SetFont('');
// Segunda página
$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();
// create table
$columns = array();
// header col
$col = array();
$col[] = array('text' => '', 'width' => '50', '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.4', 'linearea' => 'LTBR');
$col[] = array('text' => 'BBDD', 'width' => '50', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => 'B', 'fillcolor' => '135,206,250', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => 'LTBR');
$col[] = array('text' => 'FTP', 'width' => '50', 'height' => '7', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '10', 'font_style' => 'B', 'fillcolor' => '135,206,250', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => 'LTBR');
$columns[] = $col;
// data col
$col = array();
$col[] = array('text' => 'Usuario', 'width' => '50', '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.4', 'linearea' => 'LTBR');
$col[] = array('text' => 'NUsuario', 'width' => '50', '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.4', 'linearea' => 'LTBR');
$col[] = array('text' => 'NUsuarioFTP', 'width' => '50', '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.4', 'linearea' => 'LTBR');
$columns[] = $col;

// data col
$col = array();
$col[] = array('text' => 'Clave', 'width' => '50', '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.4', 'linearea' => 'LTBR');
$col[] = array('text' => 'NClave', 'width' => '50', '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.4', 'linearea' => 'LTBR');
$col[] = array('text' => 'NClave', 'width' => '50', '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.4', 'linearea' => 'LTBR');
$columns[] = $col;
$pdf->WriteHTML('<br>');



// Draw Table
//$pdf->WriteTable($columns);



//$pdf->AddPage();
$pdf->SetLink($link);
$pdf->Image('imagen/open6-logo.png',10,12,50,0,'','http://www.open6hosting.com');
$pdf->SetLeftMargin(65);
$pdf->SetFontSize(12);
$pdf->WriteHTML($name);
//$pdf->WriteHTML($name);
$pdf->WriteHTML($info);
$pdf->WriteHTML($enlace);
//$pdf->WriteHTML($nombre_base);
$pdf->Output();

echo 'Aqui ando';

//header('Location: http://www.open6hosting.com');
?>


+ 364
- 0
fpdf/htmlparser.inc Zobrazit soubor

@@ -0,0 +1,364 @@
<?php
/*
* Copyright (c) 2003 Jose Solorzano. All rights reserved.
* Redistribution of source must retain this copyright notice.
*
* Jose Solorzano (http://jexpert.us) is a software consultant.
*
* Contributions by:
* - Leo West (performance improvements)
*/
define ("NODE_TYPE_START",0);
define ("NODE_TYPE_ELEMENT",1);
define ("NODE_TYPE_ENDELEMENT",2);
define ("NODE_TYPE_TEXT",3);
define ("NODE_TYPE_COMMENT",4);
define ("NODE_TYPE_DONE",5);
/**
* Class HtmlParser.
* To use, create an instance of the class passing
* HTML text. Then invoke parse() until it's false.
* When parse() returns true, $iNodeType, $iNodeName
* $iNodeValue and $iNodeAttributes are updated.
*
* To create an HtmlParser instance you may also
* use convenience functions HtmlParser_ForFile
* and HtmlParser_ForURL.
*/
class HtmlParser {
/**
* Field iNodeType.
* May be one of the NODE_TYPE_* constants above.
*/
public $iNodeType;
/**
* Field iNodeName.
* For elements, it's the name of the element.
*/
public $iNodeName = "";
/**
* Field iNodeValue.
* For text nodes, it's the text.
*/
public $iNodeValue = "";
/**
* Field iNodeAttributes.
* A string-indexed array containing attribute values
* of the current node. Indexes are always lowercase.
*/
public $iNodeAttributes;
// The following fields are private:
private $iHtmlText;
private $iHtmlTextLength;
private $iHtmlTextIndex = 0;
private $iHtmlCurrentChar;
private $BOE_ARRAY;
private $B_ARRAY;
private $BOS_ARRAY;
/**
* Constructor.
* Constructs an HtmlParser instance with
* the HTML text given.
*/
function __construct ($aHtmlText) {
$this->iHtmlText = $aHtmlText;
$this->iHtmlTextLength = strlen($aHtmlText);
$this->iNodeAttributes = array();
$this->setTextIndex (0);
$this->BOE_ARRAY = array (" ", "\t", "\r", "\n", "=" );
$this->B_ARRAY = array (" ", "\t", "\r", "\n" );
$this->BOS_ARRAY = array (" ", "\t", "\r", "\n", "/" );
}
/**
* Method parse.
* Parses the next node. Returns false only if
* the end of the HTML text has been reached.
* Updates values of iNode* fields.
*/
function parse() {
$text = $this->skipToElement();
if ($text != "") {
$this->iNodeType = NODE_TYPE_TEXT;
$this->iNodeName = "Text";
$this->iNodeValue = $text;
return true;
}
return $this->readTag();
}
function clearAttributes() {
$this->iNodeAttributes = array();
}
function readTag() {
if ($this->iCurrentChar != "<") {
$this->iNodeType = NODE_TYPE_DONE;
return false;
}
$this->clearAttributes();
$this->skipMaxInTag ("<", 1);
if ($this->iCurrentChar == '/') {
$this->moveNext();
$name = $this->skipToBlanksInTag();
$this->iNodeType = NODE_TYPE_ENDELEMENT;
$this->iNodeName = $name;
$this->iNodeValue = "";
$this->skipEndOfTag();
return true;
}
$name = $this->skipToBlanksOrSlashInTag();
if (!$this->isValidTagIdentifier ($name)) {
$comment = false;
if (strpos($name, "!--") === 0) {
$ppos = strpos($name, "--", 3);
if (strpos($name, "--", 3) === (strlen($name) - 2)) {
$this->iNodeType = NODE_TYPE_COMMENT;
$this->iNodeName = "Comment";
$this->iNodeValue = "<" . $name . ">";
$comment = true;
}
else {
$rest = $this->skipToStringInTag ("-->");
if ($rest != "") {
$this->iNodeType = NODE_TYPE_COMMENT;
$this->iNodeName = "Comment";
$this->iNodeValue = "<" . $name . $rest;
$comment = true;
// Already skipped end of tag
return true;
}
}
}
if (!$comment) {
$this->iNodeType = NODE_TYPE_TEXT;
$this->iNodeName = "Text";
$this->iNodeValue = "<" . $name;
return true;
}
}
else {
$this->iNodeType = NODE_TYPE_ELEMENT;
$this->iNodeValue = "";
$this->iNodeName = $name;
while ($this->skipBlanksInTag()) {
$attrName = $this->skipToBlanksOrEqualsInTag();
if ($attrName != "" && $attrName != "/") {
$this->skipBlanksInTag();
if ($this->iCurrentChar == "=") {
$this->skipEqualsInTag();
$this->skipBlanksInTag();
$value = $this->readValueInTag();
$this->iNodeAttributes[strtolower($attrName)] = $value;
}
else {
$this->iNodeAttributes[strtolower($attrName)] = "";
}
}
}
}
$this->skipEndOfTag();
return true;
}
function isValidTagIdentifier ($name) {
return preg_match ("/^[A-Za-z0-9_\\-]+$/", $name);
}
function skipBlanksInTag() {
return "" != ($this->skipInTag ($this->B_ARRAY));
}
function skipToBlanksOrEqualsInTag() {
return $this->skipToInTag ($this->BOE_ARRAY);
}
function skipToBlanksInTag() {
return $this->skipToInTag ($this->B_ARRAY);
}
function skipToBlanksOrSlashInTag() {
return $this->skipToInTag ($this->BOS_ARRAY);
}
function skipEqualsInTag() {
return $this->skipMaxInTag ("=", 1);
}
function readValueInTag() {
$ch = $this->iCurrentChar;
$value = "";
if ($ch == "\"") {
$this->skipMaxInTag ("\"", 1);
$value = $this->skipToInTag ("\"");
$this->skipMaxInTag ("\"", 1);
}
else if ($ch == "'") {
$this->skipMaxInTag ("'", 1);
$value = $this->skipToInTag ("'");
$this->skipMaxInTag ("'", 1);
}
else {
$value = $this->skipToBlanksInTag();
}
return $value;
}
function setTextIndex ($index) {
$this->iHtmlTextIndex = $index;
if ($index >= $this->iHtmlTextLength) {
$this->iCurrentChar = -1;
}
else {
$this->iCurrentChar = $this->iHtmlText{$index};
}
}
function moveNext() {
if ($this->iHtmlTextIndex < $this->iHtmlTextLength) {
$this->setTextIndex ($this->iHtmlTextIndex + 1);
return true;
}
else {
return false;
}
}
function skipEndOfTag() {
while (($ch = $this->iCurrentChar) !== -1) {
if ($ch == ">") {
$this->moveNext();
return;
}
$this->moveNext();
}
}
function skipInTag ($chars) {
$sb = "";
while (($ch = $this->iCurrentChar) !== -1) {
if ($ch == ">") {
return $sb;
} else {
$match = false;
for ($idx = 0; $idx < count($chars); $idx++) {
if ($ch == $chars[$idx]) {
$match = true;
break;
}
}
if (!$match) {
return $sb;
}
$sb .= $ch;
$this->moveNext();
}
}
return $sb;
}
function skipMaxInTag ($chars, $maxChars) {
$sb = "";
$count = 0;
while (($ch = $this->iCurrentChar) !== -1 && $count++ < $maxChars) {
if ($ch == ">") {
return $sb;
} else {
$match = false;
for ($idx = 0; $idx < count($chars); $idx++) {
if ($ch == $chars[$idx]) {
$match = true;
break;
}
}
if (!$match) {
return $sb;
}
$sb .= $ch;
$this->moveNext();
}
}
return $sb;
}
function skipToInTag ($chars) {
$sb = "";
while (($ch = $this->iCurrentChar) !== -1) {
$match = $ch == ">";
if (!$match) {
for ($idx = 0; $idx < count($chars); $idx++) {
if ($ch == $chars[$idx]) {
$match = true;
break;
}
}
}
if ($match) {
return $sb;
}
$sb .= $ch;
$this->moveNext();
}
return $sb;
}
function skipToElement() {
$sb = "";
while (($ch = $this->iCurrentChar) !== -1) {
if ($ch == "<") {
return $sb;
}
$sb .= $ch;
$this->moveNext();
}
return $sb;
}
/**
* Returns text between current position and $needle,
* inclusive, or "" if not found. The current index is moved to a point
* after the location of $needle, or not moved at all
* if nothing is found.
*/
function skipToStringInTag ($needle) {
$pos = strpos ($this->iHtmlText, $needle, $this->iHtmlTextIndex);
if ($pos === false) {
return "";
}
$top = $pos + strlen($needle);
$retvalue = substr ($this->iHtmlText, $this->iHtmlTextIndex, $top - $this->iHtmlTextIndex);
$this->setTextIndex ($top);
return $retvalue;
}
}
function HtmlParser_ForFile ($fileName) {
return HtmlParser_ForURL($fileName);
}
function HtmlParser_ForURL ($url) {
$fp = fopen ($url, "r");
$content = "";
while (true) {
$data = fread ($fp, 8192);
if (strlen($data) == 0) {
break;
}
$content .= $data;
}
fclose ($fp);
return new HtmlParser ($content);
}
?>

+ 3
- 3
lib/module.conf.php Zobrazit soubor

@@ -33,10 +33,10 @@ $items[] = array( 'title' => 'Nuevo servicio web',
'html_id' => 'new_service_webdns'
);
/*$items[] = array( 'title' => 'BBDD y FTP',
/*$items[] = array( 'title' => 'La BD',
'target' => 'content',
'link' => 'webdns/ftp_bd_service.php',
'html_id' =>'ftp_service'
'link' => 'webdns/database_edit.php',
'html_id' =>'db_service'
);*/
$items[] = array( 'title' => 'Versión',
'target' => 'content',


+ 31
- 11
new_service_webdns.php Zobrazit soubor

@@ -114,7 +114,7 @@ class page_action extends tform_actions {
$paramsBD = array(
'server_id' => $camDnsRR['server_id'],
'parent_domain_id' => $sitio_id['domain_id'],
'type' => 'y',
'type' => 'mysql',
'database_quota' => '-1',
'database_name' => $db_user_params['database_user'],
'database_user_id' => $db_user_id,
@@ -166,14 +166,19 @@ class page_action extends tform_actions {
</b><br>Nombre BBDD: <b>' . $this->nombre_db_txt . '</b><br>
<br>Usuario FTP: <b>'. $this->usuario_ftp_txt .'</b><br>Contraseña: <b>' . $this->pass_ftp_txt . '</b><br><br></div></br>';

$hoy = date("d-m-Y H:i:s");

$html_resultado = '<br><b>BBDD</b><br>
Usuario Base de Datos: <b>'. $this->usuario_db_txt .'</b><br>
$html_resultado = '<br><br><b>BBDD</b><br>
Usuario: <b>'. $this->usuario_db_txt .'</b><br>
Nombre Base de Datos: <b>' . $this->nombre_db_txt .'</b><br>
Clave Base de Datos: <b>' . $this->pass_db_txt . '</b><br><br>
Clave: <b>' . $this->pass_db_txt . '</b><br><br>
<b>FTP</b><br>
Usuario FTP: <b>'. $this->usuario_ftp_txt .'</b><br>
Clave FTP: <b>' . $this->pass_ftp_txt . '</b><br><br>';
Usuario: <b>'. $this->usuario_ftp_txt .'</b><br>
Clave: <b>' . $this->pass_ftp_txt . '</b><br><br>
<b> </b><br>
Nuevo dominio: <b>'. $fields['domain'].'</b><br><br>
Documento generado: <b>' . $hoy . '</b><br><br>';


@@ -183,10 +188,16 @@ class page_action extends tform_actions {
/*echo '<a href="webdns/pdf_o6h.php" target="_blank" onclick="window.open(this.href, this.target,
"width=400, hight=150, top=200, toolbar=no, status=no, menubar=no");return false;"><img src="imagen/open6-logo.png"></img></a>';
*/
$eldom = $fields['domain'];
echo '<form method="post" id="formulario" action="webdns/pdf_o6h.php" target="_blank">';
echo '<input id="pdf_power" name="pdf_power" type="hidden" value="'.$html_resultado.'">';
echo '<input type="submit" value="PDF">';
/*echo '<input id="usuario_bd" name="usuario_bd" type="hidden" value="'.$this->usuario_db_txt.'">';
echo '<input id="nombre_bd" name="nombre_bd" type="hidden" value="'.$this->nombre_db_txt.'">';
echo '<input id="pass_bd" name="pass_bd" type="hidden" value="'.$this->pass_db_txt.'">';
echo '<input id="usuario_ftp" name="usuario_ftp" type="hidden" value="'.$this->usuario_ftp_txt.'">';
echo '<input id="pass_ftp" name="pass_ftp" type="hidden" value="'.$this->pass_ftp_txt.'">';*/
echo '<input id="dominio_nuevo" name="dominio_nuevo" type="hidden" value="'.$eldom.'">';
echo '<input type="submit" class="btn btn-default formbutton-success" value="Descargar PDF">';
/*echo '<button class="btn btn-default formbutton-success" id="dom-edit-submit" type="button" value="'.$html_resultado.'">FueraPdf</button>';
echo '<a href="webdns/pdf_o6h.php" target="_blank" onclick="window.open(this.href, this.target,
"width=400, hight=150, top=200, toolbar=no, status=no, menubar=no");return false;"><img src="imagen/open6-logo.png"></img>FueraPDF</a>';
@@ -199,7 +210,7 @@ class page_action extends tform_actions {
//echo '<input type="button" id="btn-ingresar" value="Ingresar" />';
/*echo '<a href="webdns/pdf_o6h.php?datos_pdf='.$html_resultado.'" target="_blank" onclick="window.open(this.href, this.target,
"toolbar=no, status=no, menubar=no);return false;">Crear PDF</img></a>';*/
$datos_test = 'Datos muchosssss datos';
//$datos_test = 'Datos muchosssss datos';

//echo'<script type="text/javascript">document.forms[0].datos_test.value=".$datos_test.";document.forms[0].submit();</script>';
//echo '<a href=\"javascript:formularioSubmit('.$datos_test.');\">Pedefeando '.$datos_test.'</a>';
@@ -251,6 +262,10 @@ class page_action extends tform_actions {
return $this->es_subdominio;
}
function onAfterInsert(){
global $app, $conf;
$app->uses('sites_database_plugin');
}

//Crear subdominio
function crearSubDominio($remoto, $campoSubDominio){
@@ -727,20 +742,25 @@ class page_action extends tform_actions {

}


class remote_actions extends remoting {
public function insert_query($formdef_file, $client_id, $params, $event_identifier = '') {
return $this->insertQuery($formdef_file, $client_id, $params, $event_identifier);
}

public function sites_database_add($client_id, $params){
global $app;
global $app, $conf;

//$app->remoting_lib->loadFormDef('../sites/form/database.tform.php');
//$app->tform->formDef('../sites/form/database.tform.php');
$sql = $this->insertQueryPrepare('../sites/form/database.tform.php', $client_id, $params);
if($sql !== false) {
$app->uses('sites_database_plugin');
//print_r($sql);
$this->id = 0;
$this->dataRecord = $params;
//$app->uses('sites_database_plugin');
$app->sites_database_plugin->processDatabaseInsert($this);

$retval = $this->insertQueryExecute($sql, $params);


+ 13
- 136
pdf_o6h.php Zobrazit soubor

@@ -1,149 +1,26 @@
<?php

require('fpdf/fpdf.php');


class PDFO6H extends FPDF
{
protected $B = 0;
protected $I = 0;
protected $U = 0;
protected $HREF = '';


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);
}
}


$info = $_POST['pdf_power'];
/*$usuario_bd = $_POST['usuario_bd'];
$nombre_bd = $_POST['nombre_bd'];
$pass_bd = $_POST['pass_bd'];
$usuario_ftp = $_POST['usuario_ftp'];
$pass_ftp = $_POST['pass_ftp'];*/
$dominio_nuevo = $_POST['dominio_nuevo'];

//echo "La información en directorio ispconfig: ".$info;


echo '<form method="post" id="formulario" id="fuera" action="crear_pdf_o6h.php">';
echo '<input id="pdf_power2" name="pdf_power2" type="hidden" value="'.$info.'">';
//echo '<input id="pulsame" type="submit" value="FueraPDF">';
/*echo '<a href="webdns/pdf_o6h.php" target="_blank" onclick="window.open(this.href, this.target,
"width=400, hight=150, top=200, toolbar=no, status=no, menubar=no");return false;"><img src="imagen/open6-logo.png"></img>FueraPDF</a>';
*/
/*echo '<input id="nombre_bd" name="nombre_bd" type="hidden" value="'.$nombre_bd.'">';
echo '<input id="usuario_bd" name="usuario_bd" type="hidden" value="'.$usuario_db.'">';
echo '<input id="nombre_bd" name="nombre_bd" type="hidden" value="'.$this->nombre_db_txt.'">';
echo '<input id="pass_bd" name="pass_bd" type="hidden" value="'.$this->pass_db_txt.'">';
echo '<input id="usuario_ftp" name="usuario_ftp" type="hidden" value="'.$this->usuario_ftp_txt.'">';
echo '<input id="pass_ftp" name="pass_ftp" type="hidden" value="'.$this->pass_ftp_txt.'">';*/
echo '<input id="dominio_nuevo" name="dominio_nuevo" type="hidden" value="'.$dominio_nuevo.'">';
echo '</form>';

echo '<script type="text/javascript">';
//echo 'alert(document.getElementById("pdf_power2").value);';
echo 'var vamos = document.getElementById("formulario").submit();';
//echo 'var vamos = document.getElementById("formulario");';
//echo 'vamos.href ="crear_pdf_o6h.php";';
//echo 'window.open();';
//echo 'vamos.target() = "_blank";';
//echo 'vamos.submit();';
//echo 'vamos.target ="_blank";';

//echo '$('#fuera').submit();';
//echo 'document.fuera.submit();';
echo '</script>';
//echo $info;

//header('Location: crear_pdf_o6h.php');
/*
?>
<script type="text/javascript">

jQuery('#pulsame').click(function() {
//$("#pdf_power").val("1");
alert(document.getElementById("pdf_power2").value);
//ISPConfig.submitForm('formulario','webdns/pdf_o6h.php');
//w = window.open('webdns/pdf_o6h.php');
//w.document.open();
//w.document.write($html_resultado);
//w.document.write(document.getElementById("pdf_power").value);
//w.document.close();
});

document.getElementById("fuera").submit();
//$('#fuera').submit();
/*function crearElPdf(url) {
alert ("Esto es javascript");
window.open(url, "nuevo", "directories=no, location=no, menubar=no, scrollbars=yes, statusbar=no, tittlebar=no, width=400, height=400");
}*/
/*</script>*/

Načítá se…
Zrušit
Uložit