Ejemplo n.º 1
0
 public function BBCode($text)
 {
     $parser = new HTML_BBCodeParser(array('filters' => join(',', $this->_filters)));
     $parser->setText($text);
     $parser->parse();
     return $parser->getParsed();
 }
 public static function ModifyText($text)
 {
     require_once "BBCodeParser.php";
     $parser = new HTML_BBCodeParser();
     $parser->setText($text);
     $parser->parse();
     return $parser->getParsed();
 }
Ejemplo n.º 3
0
/**
 * Stores a well verified comment into the database
 *
 * @return null
 * @access public
 */
function lesen_saveComment($name, $email, $url, $body, $paper_id, $par)
{
    global $db;
    $parser = new HTML_BBCodeParser();
    $parser->setText($body);
    $parser->parse();
    $body = $parser->getParsed();
    $query = "insert into lesen_comments(author, email, url, body, \n                                       timestamp, paper_id, parent_id)\n            values (" . $db->quote($name) . "," . $db->quote($email) . "," . $db->quote($url) . "," . $db->quote($body, 'text') . "," . "'" . date('Y-m-d H:i:s') . "'" . "," . $db->quote($paper_id) . "," . $db->quote($par) . ")";
    $db->query($query);
}
Ejemplo n.º 4
0
 /**
  * Method to take a text string, parse it for BBCode and return a XHTML compliant string with divs
  *
  * @param string $text
  * @return string
  */
 public function parse4bbcode($text)
 {
     if (class_exists('HTML_BBCodeParser')) {
         $parser = new HTML_BBCodeParser(parse_ini_file('BBCodeParser.ini'));
         //log_debug("set the parser");
         $parser->setText($text);
         $parser->parse();
         return $parser->getParsed();
     } else {
         return $text;
     }
 }
Ejemplo n.º 5
0
 function bbcode_parse_data(&$pParseHash, &$pCommonObject)
 {
     global $gLibertySystem;
     $data = $pParseHash['data'];
     $data = preg_replace('/\\[(quote|code):[0-9a-f]+=/', '[\\1=', $data);
     $data = preg_replace('/:[0-9a-f]+\\]/', ']', $data);
     /* get options from the ini file 
     	// $config = parse_ini_file('BBCodeParser.ini', true);
     	$config = parse_ini_file('doc/Text_Wiki_BBCode/doc/BBCodeParser_V2.ini', true);
     	$options = &PEAR::getStaticProperty('HTML_BBCodeParser', '_options');
     	$options = $config['HTML_BBCodeParser'];
     	unset($options);
     	 */
     $parser = new HTML_BBCodeParser('BBCodeParser_V2.ini');
     $parser->setText($data);
     $parser->parse();
     $ret = $parser->getParsed();
     return $ret;
 }
Ejemplo n.º 6
0
/* adjust include_path to include PEAR */
ini_set('include_path', ini_get('include_path') . ':/usr/share/pear');
/* all your errors are belong to us */
error_reporting(E_ALL);
/* require PEAR and the parser */
require_once 'PEAR.php';
require_once 'HTML/BBCodeParser.php';
/* get options from the ini file */
$config = parse_ini_file('BBCodeParser.ini', true);
$options =& PEAR::getStaticProperty('HTML_BBCodeParser', '_options');
$options = $config['HTML_BBCodeParser'];
unset($options);
/* do yer stuff! */
$parser = new HTML_BBCodeParser();
$parser->setText(@$_GET['string']);
$parser->parse();
$parsed = $parser->getParsed();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>HTML_BBCodeParser (by Stijn de Reede)</title>
</head>
<body>
<form method='get' action='parser.php'>
<table border='1' cellpadding='5' cellspacing='0'>
<tr><td valign='top'>
input:<br>
<textarea cols='45' rows='10' name='string'><?php 
echo @$_GET['string'];
?>
 function getdata(&$tpl)
 {
     global $system, $_CONFIG, $_GET, $is_admin;
     $lnk = "";
     if (isset($_GET) and isset($_GET['act']) and $is_admin) {
         if ($_GET['act'] == "del" and isset($_GET['id'])) {
             $char_link = $system->mysql_connect();
             mysql_query("DELETE  FROM  `gm_tickets` WHERE `guid`=" . $_GET['id'], $char_link);
             $system->cache->open("./Cache/MySQL", NULL);
             $system->cache->destroy('tickets');
             $lnk .= "<script type=\"text/javascript\">self.location=\"?m=" . $this->getlink() . "\";</script>";
         } elseif ($_GET['act'] == "update") {
             $system->cache->open("./Cache/MySQL", NULL);
             $system->cache->destroy('tickets');
             $lnk .= "<script type=\"text/javascript\">self.location=\"?m=" . $this->getlink() . "\";</script>";
         } elseif ($_GET['act'] == "unstuck" and isset($_GET['cname']) and isset($system->mods->mods['uns'])) {
             $char_link = $system->mysql_connect();
             $sq = mysql_query("SELECT `characters`.`guid` FROM `characters` WHERE `characters`.`name` =  '" . mysql_escape_string($_GET['cname']) . "' ORDER BY `characters`.`level` DESC", $char_link);
             if (mysql_num_rows($sq) == 1 and !$system->is_online($_GET['cname'])) {
                 $dr = mysql_fetch_array($sq);
                 $system->mods->mods['uns']->makeunstuck($char_link, $dr['guid']);
             }
             $lnk .= "<script type=\"text/javascript\">self.location=\"?m=" . $this->getlink() . "\";</script>";
         }
     }
     $tpl->setBlock('MOD_PAGE', 'ST');
     if (isset($char_link)) {
         extract($system->cache->c_get("MySQL", "tickets", array('_CONFIG' => $_CONFIG, 'char_link' => $char_link)), EXTR_OVERWRITE);
     } else {
         extract($system->cache->c_get("MySQL", "tickets", array('_CONFIG' => $_CONFIG)), EXTR_OVERWRITE);
     }
     $params = array('itemData' => $data, 'perPage' => 10, 'delta' => 8, 'append' => true, 'separator' => ' | ', 'clearIfVoid' => false, 'urlVar' => 'pd', 'mode' => 'Jumping');
     $pager =& Pager::factory($params);
     $page_data = $pager->getPageData();
     $links = $pager->getLinks();
     //print_r($links);
     foreach ($page_data as $key => $val) {
         $isonline = $system->is_online($val['name']);
         $n = "Name:{$val['name']}({$val['level']})" . "\n<br/> id:{$val['guid']}<br/>";
         if ($isonline) {
             $n .= "Online";
         } else {
             $n .= "Offline";
         }
         if ($is_admin) {
             // $n.="<hr/>";
             if (isset($system->mods->mods['uns']) and !$isonline) {
                 $n .= "<hr/><a href=\"?m=" . $this->getlink() . "&amp;act=unstuck&amp;cname={$val['name']}\">UNSTUCK</a>";
             }
             if (isset($system->mods->mods['lookup'])) {
                 $n .= "<hr/><a href=\"?m=lookup&amp;char={$val['name']}\">LOOKUP</a>";
             }
             $n .= "<hr/>&nbsp;<br/><a href=\"?m=" . $this->getlink() . "&amp;act=del&amp;id={$val['guid']}\">DELETE</a>";
         }
         $tpl->setParam('ST_ID', $n);
         $parser = new HTML_BBCodeParser();
         $parser->setText(htmlentities($val['message'], HTML_ENTITIES, 'UTF-8'));
         $parser->parse();
         $tpl->setParam('ST_MESS', nl2br($parser->getParsed()));
         $tpl->setParam('ST_TIME', date("H:i:s d.m.y", $val['timestamp']));
         $tpl->parseParam('ST', 'STDynamic', true);
     }
     if (isset($links['back']) and $links['back'] != "") {
         $lnk .= "<div align=\"left\">" . $links['back'] . "</div>";
     }
     $lnk .= "<div align=\"center\">" . $links['pages'] . "</div>";
     if (isset($links['next']) and $links['next'] != "") {
         $lnk .= "<div align=\"right\">" . $links['next'] . "</div>";
     }
     if ($is_admin) {
         $tpl->setParam('ST_PAGE', $lnk . "\n<pre><a href=\"?m=" . $this->getlink() . "&amp;act=update\">UPDATE</a>");
     } else {
         $tpl->setParam('ST_PAGE', $lnk);
     }
     $tpl->setParam('ST', $tpl->getParam('STDynamic'));
 }