Caricamento del resto di questo confronto.

bbcode.php

Creato Il diff non scade mai
0 rimozioni
529 linee
0 aggiunte
529 linee
<?php
<?php
/*=======================================================================
/*=======================================================================
Nuke-Evolution Basic: Enhanced PHP-Nuke Web Portal System
Nuke-Evolution Basic: Enhanced PHP-Nuke Web Portal System
=======================================================================*/
=======================================================================*/


/***************************************************************************
/***************************************************************************
* bbcode.php
* bbcode.php
* -------------------
* -------------------
* begin : Saturday, Feb 13, 2001
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
* email : support@phpbb.com
*
*
* Id: bbcode.php,v 1.36.2.35 2005/07/19 20:01:10 acydburn Exp
* Id: bbcode.php,v 1.36.2.35 2005/07/19 20:01:10 acydburn Exp
*
*
***************************************************************************/
***************************************************************************/


/***************************************************************************
/***************************************************************************
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* (at your option) any later version.
*
*
***************************************************************************/
***************************************************************************/


/*****[CHANGES]**********************************************************
/*****[CHANGES]**********************************************************
-=[Base]=-
-=[Base]=-
Caching System v1.0.0 10/29/2005
Caching System v1.0.0 10/29/2005
-=[Mod]=-
-=[Mod]=-
Advanced BBCode Box v5.0.0a 11/16/2005
Advanced BBCode Box v5.0.0a 11/16/2005
Select Expand BBcodes v1.0.2 06/14/2005
Select Expand BBcodes v1.0.2 06/14/2005
Force Word Wrapping v1.0.16 06/15/2005
Force Word Wrapping v1.0.16 06/15/2005
Force Word Wrapping - Configurator v1.0.16 06/15/2005
Force Word Wrapping - Configurator v1.0.16 06/15/2005
Anti Spam v1.1.0 06/18/2005
Anti Spam v1.1.0 06/18/2005
PHP Syntax Highlighter BBCode v3.0.7 07/10/2005
PHP Syntax Highlighter BBCode v3.0.7 07/10/2005
Select Expand BBcodes (PHP add-on) v1.0.2 07/18/2005
Select Expand BBcodes (PHP add-on) v1.0.2 07/18/2005
Allow multiple spaces in posts v1.0.0 07/30/2005
Allow multiple spaces in posts v1.0.0 07/30/2005
Advanced Username Color v1.0.5 08/03/2005
Advanced Username Color v1.0.5 08/03/2005
Extended Quote Tag v1.0.0 08/17/2005
Extended Quote Tag v1.0.0 08/17/2005
Select Expand & Extended Quote Tag v1.0.0 08/26/2005
Select Expand & Extended Quote Tag v1.0.0 08/26/2005
Hide Images and Links v1.0.0 08/30/2005
Hide Images and Links v1.0.0 08/30/2005
BBCode Box v1.0.0 10/06/2005
BBCode Box v1.0.0 10/06/2005
Lytebox Resize Images v3.2.2
Lytebox Resize Images v3.2.2
Hide BBCode v1.2.0
Hide BBCode v1.2.0
************************************************************************/
************************************************************************/


if (!defined('IN_PHPBB'))
if (!defined('IN_PHPBB'))
{
{
die('Hacking attempt');
die('Hacking attempt');
}
}


define("BBCODE_UID_LEN", 10);
define("BBCODE_UID_LEN", 10);


// global that holds loaded-and-prepared bbcode templates, so we only have to do
// global that holds loaded-and-prepared bbcode templates, so we only have to do
// that stuff once.
// that stuff once.


$bbcode_tpl = null;
$bbcode_tpl = null;
/**
/**
* Loads bbcode templates from the bbcode.tpl file of the current template set.
* Loads bbcode templates from the bbcode.tpl file of the current template set.
* Creates an array, keys are bbcode names like "b_open" or "url", values
* Creates an array, keys are bbcode names like "b_open" or "url", values
* are the associated template.
* are the associated template.
* Probably pukes all over the place if there's something really screwed
* Probably pukes all over the place if there's something really screwed
* with the bbcode.tpl file.
* with the bbcode.tpl file.
*
*
* Nathan Codding, Sept 26 2001.
* Nathan Codding, Sept 26 2001.
*/
*/


function load_bbcode_template()
function load_bbcode_template()
{
{
global $template;
global $template;
$tpl_filename = $template->make_filename('bbcode.tpl');
$tpl_filename = $template->make_filename('bbcode.tpl');
$tpl = fread(fopen($tpl_filename, 'r'), filesize($tpl_filename));
$tpl = fread(fopen($tpl_filename, 'r'), filesize($tpl_filename));


// replace \ with \\ and then ' with \'.
// replace \ with \\ and then ' with \'.
$tpl = str_replace('\\', '\\\\', $tpl);
$tpl = str_replace('\\', '\\\\', $tpl);
$tpl = str_replace('\'', '\\\'', $tpl);
$tpl = str_replace('\'', '\\\'', $tpl);


// strip newlines.
// strip newlines.
$tpl = str_replace("\n", '', $tpl);
$tpl = str_replace("\n", '', $tpl);


// Turn template blocks into PHP assignment statements for the values of $bbcode_tpls..
// Turn template blocks into PHP assignment statements for the values of $bbcode_tpls..
$tpl = preg_replace('#<!-- BEGIN (.*?) -->(.*?)<!-- END (.*?) -->#', "\n" . '$bbcode_tpls[\'\\1\'] = \'\\2\';', $tpl);
$tpl = preg_replace('#<!-- BEGIN (.*?) -->(.*?)<!-- END (.*?) -->#', "\n" . '$bbcode_tpls[\'\\1\'] = \'\\2\';', $tpl);


$bbcode_tpls = array();
$bbcode_tpls = array();


eval($tpl);
eval($tpl);


return $bbcode_tpls;
return $bbcode_tpls;
}
}
/**
/**
* Prepares the loaded bbcode templates for insertion into preg_replace()
* Prepares the loaded bbcode templates for insertion into preg_replace()
* or str_replace() calls in the bbencode_second_pass functions. This
* or str_replace() calls in the bbencode_second_pass functions. This
* means replacing template placeholders with the appropriate preg backrefs
* means replacing template placeholders with the appropriate preg backrefs
* or with language vars. NOTE: If you change how the regexps work in
* or with language vars. NOTE: If you change how the regexps work in
* bbencode_second_pass(), you MUST change this function.
* bbencode_second_pass(), you MUST change this function.
*
*
* Nathan Codding, Sept 26 2001
* Nathan Codding, Sept 26 2001
*
*
*/
*/
function prepare_bbcode_template($bbcode_tpl)
function prepare_bbcode_template($bbcode_tpl)