[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/system/classes/ -> conversion.class.php (source)

   1  <?php
   2  
   3  /* Reminder: always indent with 4 spaces (no tabs). */
   4  // +---------------------------------------------------------------------------+
   5  // | Geeklog 1.3                                                               |
   6  // +---------------------------------------------------------------------------+
   7  // | lib-pdf.php                                                               |
   8  // |                                                                           |
   9  // | Geeklog PDF generator.                                                    |
  10  // +---------------------------------------------------------------------------+
  11  // | Copyright (C) 2004 by the following authors:                              |
  12  // |                                                                           |
  13  // | Authors: Justin Carlson    - justin@w3abode.com                           |
  14  // |          Tony Bibbs        - tony@geeklog.net                             |
  15  // +---------------------------------------------------------------------------+
  16  // |                                                                           |
  17  // | This program is free software; you can redistribute it and/or             |
  18  // | modify it under the terms of the GNU General Public License               |
  19  // | as published by the Free Software Foundation; either version 2            |
  20  // | of the License, or (at your option) any later version.                    |
  21  // |                                                                           |
  22  // | This program is distributed in the hope that it will be useful,           |
  23  // | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
  24  // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
  25  // | GNU General Public License for more details.                              |
  26  // |                                                                           |
  27  // | You should have received a copy of the GNU General Public License         |
  28  // | along with this program; if not, write to the Free Software Foundation,   |
  29  // | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
  30  // |                                                                           |
  31  // +---------------------------------------------------------------------------+
  32  //
  33  // $Id: conversion.class.php,v 1.2 2006/09/06 05:31:01 ospiess Exp $
  34  
  35  class conversion
  36  {
  37  
  38      /**
  39      * @var string
  40      */
  41      var $html = null;
  42  
  43      /**
  44      *
  45      * @author Justin Carlson <justin.carlson@iowa.gov>
  46      * @access public
  47      * @param string $content html / text mixed string
  48      * @return null
  49      *
  50      */
  51      function addHtml($content)
  52      {
  53          $this->html = $this->html . $content;
  54      }
  55  
  56      /**
  57      *
  58      * @author Justin Carlson <justin.carlson@iowa.gov>
  59      * @access public
  60      * @param formfile , data id
  61      * @return  mixed
  62      *
  63      */
  64      function convert($opt,$opt2=''){
  65          global $formloader, $_CONF;
  66  
  67          // Need to use global HTML element
  68          $file = $this->html;
  69          if (is_array($file)) {
  70              $file = implode('',$file);
  71          }
  72  
  73          preg_match_all("|<\?=(.*?)\?>|U",$file,$out);
  74          for($i=0; $i < count($out[0]); $i++) {
  75              eval('$temp=' . $out[1][$i] . ';');
  76              $file = str_replace($out[0][$i], stripslashes($temp), $file);
  77          }
  78  
  79          if ($opt == 1) {
  80  
  81              $file=str_replace("=\"","1!ZYOUNK!1",$file);
  82  
  83              $formvert['IEhackedhtml'][1]='/\=(.*?)\>/i';
  84              $formvert['IEhackedhtml'][2]='="\\1">';
  85              $file = preg_replace($formvert['IEhackedhtml'][1],$formvert['IEhackedhtml'][2],$file);
  86  
  87              $file=str_replace("=\"","1!ZYOUNK!1",$file);
  88  
  89              $formvert['IEhackedhtml'][1]='/\=(.*?) /i';
  90              $formvert['IEhackedhtml'][2]='="\\1" ';
  91              $file = preg_replace($formvert['IEhackedhtml'][1],$formvert['IEhackedhtml'][2],$file);
  92  
  93              $file=str_replace("1!ZYOUNK!1","=\"",$file);
  94  
  95              $formvert['optsel'][1]='/<input(.*)type=\"radio\"(.*)value=\"(.*)\"(.*)(SELECTED|CHECKED)(.*)>(.*)<\/input>/i';
  96              $formvert['optsel'][2]='<input\\1 type="hidden"\\2 value="\\3"><img src="'.$_CONF['host'].$_CONF['urlpath'].'../images/rchecked.gif"><B>\\7</B>';
  97              $file = preg_replace($formvert['optsel'][1],$formvert['optsel'][2],$file);
  98  
  99              $formvert['optsel'][1]='/<input(.*)type=\"checkbox\"(.*)value=\"(.*)\"(.*)(SELECTED|CHECKED)(.*)>(.*)<\/input>/i';
 100              $formvert['optsel'][2]='<input\\1 type="hidden"\\2 value="\\3"><img src="'.$_CONF['host'].$_CONF['urlpath'].'../images/checked.gif"><B>\\7</B>';
 101              $file = preg_replace($formvert['optsel'][1],$formvert['optsel'][2],$file);
 102  
 103              $formvert['optnonsel'][1]='/<input(.*)type="radio"(.*)value="(.*)"(.*)>(.*)<\/input>/i';
 104              $formvert['optnonsel'][2]='<img src="'.$_CONF['host'].$_CONF['urlpath'].'../images/runchecked.gif">\\5';
 105              $file = preg_replace($formvert['optnonsel'][1],$formvert['optnonsel'][2],$file);
 106  
 107              $formvert['optnonsel'][1]='/<input(.*)type="checkbox"(.*)value="(.*)"(.*)>(.*)<\/input>/i';
 108              $formvert['optnonsel'][2]='<img src="'.$_CONF['host'].$_CONF['urlpath'].'../images/unchecked.gif">\\5';
 109              $file = preg_replace($formvert['optnonsel'][1],$formvert['optnonsel'][2],$file);
 110  
 111              $formvert['textarea'][1]='/<textarea(.*?)name="(.*?)"(.*?)>(.*?)<\/textarea>/is';
 112              $formvert['textarea'][2]='<input type="hidden" name="\\2" value="\\4"><table border=1 class="borderon" cellpadding="1"\\3><tr><td idx>\\4</td></tr></table>';
 113              $file = preg_replace($formvert['textarea'][1],$formvert['textarea'][2],$file);
 114  
 115              $formvert['textarea'][1]='/<select(.*?)name="(.*?)"(.*?)>(.*?)<option value="(.*?)"\ (CHECKED|SELECTED)>(.*?)<\/option>(.*?)<\/select>/is';
 116              $formvert['textarea'][2]='<input type="hidden" name="\\2" value="\\5">';
 117              $formvert['textarea'][2].='<table bgcolor="#eeeeee" cellpadding="-1" border="1"><tr><td>';
 118              $formvert['textarea'][2].='&nbsp;&nbsp;\\7&nbsp;</td><td><img src="'.$_CONF['host'].$_CONF['urlpath'].'../images/selectbox.gif">';
 119              $formvert['textarea'][2].='</td></tr></table>';
 120              $file = preg_replace($formvert['textarea'][1],$formvert['textarea'][2],$file);
 121  
 122  
 123              $formvert['textarea2'][1]='/<select(.*?)>(.*?)<\/select>/is';
 124              $formvert['textarea2'][2]='<table bgcolor="#eeeeee" cellpadding="-1" border="1"><tr><td>';
 125              $formvert['textarea2'][2].='&nbsp;&nbsp;None&nbsp;</td><td><img src="'.$_CONF['host'].$_CONF['urlpath'].'../images/selectbox.gif">';
 126              $formvert['textarea2'][2].='</td></tr></table>';
 127              $file = preg_replace($formvert['textarea2'][1],$formvert['textarea2'][2],$file);
 128  
 129              preg_match_all('/<td\ idx>(.*?)<\/td>/is',$file,$matches);
 130              for($l=0;$l<count($matches[1]);$l++){
 131                  $file=str_replace($matches[1][$l],nl2br($matches[1][$l]),$file);
 132              }
 133          }
 134  
 135          $file=str_replace("/>", ">", $file);
 136          $file=str_replace("/ >", ">", $file);
 137  
 138          if ($opt2 == '1'){
 139              $file=preg_replace('/<input(.*?)type="submit"(.*?)>/i','',$file);
 140          } else {
 141              $formvert['textbox'][1]='/<input(.*?)type="submit"(.*?)value="(.*?)"(.*?)>/i';
 142              $formvert['textbox'][2]='<table bgcolor="#555555" border=1 class="borderon" cellpadding="1"\\4><tr><td>';
 143              $formvert['textbox'][2].='<table bgcolor="#eeeeee" border=0 class="borderon" cellpadding="0"\\4><tr><td>\\3</td></tr></table>';
 144              $formvert['textbox'][2].='</td></tr></table>';
 145              $file = preg_replace($formvert['textbox'][1],$formvert['textbox'][2],$file);
 146          }
 147          return $file;
 148      }
 149  
 150  }
 151  
 152  ?>


Généré le : Wed Nov 21 12:27:40 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics