Page 13 of 15

PostPosted: Wed May 10, 2006 8:13 pm
Author: Threat009
"Kat";p="5435" wrote:I wish I could. Honestly I don't have any extra mods on my forum but I changed the layout and whenever I have used the premodded files it always messes up the layout and I have to try to recall how I changed everything and change it back

Ouch! Not for nothing, b/c I can relate w/wanting to customize my layout, but you are gonna have a real hard time w/future updates, that is if you manage to get past this one. <img> You may want to weigh your options and think about reverting back to the default layout. Just a suggestion, but I think it would save you alot of headache and hassle.

Re: Release of upgrade for phpbb2.0.20

PostPosted: Thu May 11, 2006 1:31 am
Author: found it
@KAT

Fortunately the template files that are premodded are not that big a deal...

I assume that by change the layout you aare referring to the way things look....

I would do the code changes for the template files by hand as they are minimal and it says starting from scratch again

:mrgreen:

Re: Release of upgrade for phpbb2.0.20

PostPosted: Thu May 11, 2006 7:12 am
Author: Kat
I think I stated myself wrong there.

As for the different layout...what I mean is, I removed things such as The Shoutbox, and mini Cal that were at the bottom of the forum page. When I use premodded files, I have to remove these again and I never remember what the code is, so I have to go back and search for them and remove them again. I guess that would probably be easier to edit then all the individual files for an upgrade.

I am doing the code changes instead of the premodded files. As stated above, I don't have that mssql.php file at all, is that a big deal? As in the code changes area there is nothing listed there to change, nor is there anything refering to this file in the premodded files.

as for posting.php, I don't even see it in the premodded files to upload instead of doing the code changes myself (because the code I need to find isn't in my file). So should I not worry about this file? What should I do about it?

Sorry that I need so much help, I'm just so worried about upgrading these days. Finally I got my forum back together (I've been MIA for 2 years without a computer) and during that time we were hacked twice while using normal phpbb and I went from having 1000 active members to 300 and only a few or so post now so I'm trying to get it back to what it once was...and my host doesn't help much sometimes with only allowing me 50 sql queries an hour.

Thanks for any help anyone can give me


EDIT: ah gosh, maybe I shouldn't be doing this so early in the morning, now I see posting.php in the premodded files, lol, I'm gonna try just using the premodded file for this one file

EDIT #2 - except the "replace with" code for that file isn't in that file either???

Re: Release of upgrade for phpbb2.0.20

PostPosted: Thu May 11, 2006 7:23 am
Author: found it
the premodded files are the ones that need changing....the manual edits script is the original form phpbb so some of the files that show there are not needed for integramod there...sorry for the confusion..

:mrgreen:

PostPosted: Thu May 11, 2006 7:26 am
Author: Mighty07
"Eon";p="5409" wrote:How was it incorrect? If it worked after you installed the security update. Are you sure everything is at the right permissions settings?

Did you update the phpbb file with what you typed in? You may want to check your database to make sure they are set to the right values, and if all else fails you can set the # of mods and admins there.


Ok. I've corrected the return values. So, now the special functions inside security are all working.
The things that keeps failling is the auto-backup's.

It creates the new .sql file with only this inside:

-- MySQL dump 10.9
--
-- Host: localhost Database: forumname
-- ------------------------------------------------------
-- Server version 4.1.12

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

Re: Release of upgrade for phpbb2.0.20

PostPosted: Thu May 11, 2006 7:26 am
Author: Kat
lol, so in other words, I may come across a few things here and there that aren't in my files, but I shouldn't worry about them?

I know you guys do this all for free and help us all out, but why? lol this stuff is so confusing. I suppose it would be better if I could understand php...HTML is straight forward to me, but this stuff....wow, you guys put a lot into this...thank you <img>

Re: Release of upgrade for phpbb2.0.20

PostPosted: Thu May 11, 2006 7:54 am
Author: Kat
I know you said the template files weren't a big deal to edit. But what if I want to edit it? In comparing the two files: in board_config_body.tpl (premodded vs. mine) I only have one little edit to make:

Here is mine:

Code: Select all
<td>{L_FLOOD_INTERVAL} <br><span>{L_FLOOD_INTERVAL_EXPLAIN}</span></td><td> <input></td></tr>     <tr>         <td>{L_MAX_LOGIN_ATTEMPTS}<br><span>{L_MAX_LOGIN_ATTEMPTS_EXPLAIN}</span></td>         <td><input></td>     </tr>


and here is the premodded]<td>{L_FLOOD_INTERVAL} <br><span>{L_FLOOD_INTERVAL_EXPLAIN}</span></td><td> <input></td>     </tr>     <tr>         <td>{L_SEARCH_FLOOD_INTERVAL} <br><span>{L_SEARCH_FLOOD_INTERVAL_EXPLAIN}</span></td>         <td><input></td>  </tr>     <tr>         <td>{L_MAX_LOGIN_ATTEMPTS}<br><span>{L_MAX_LOGIN_ATTEMPTS_EXPLAIN}</span></td>         <td><input></td>     </tr>[/code]

So I assume, I just put the code in above my MAX LOGIN ATTEMPTS and it would be edited.

But since you said they weren't really needed, will including this hurt the board? or is it better to have it then not have it at all

Re: Release of upgrade for phpbb2.0.20

PostPosted: Thu May 11, 2006 8:10 am
Author: found it
yes definately add that code ...all the code changes need to be done for the templates....

What I meant was they were not that hard to do manually if you had changed some of the code around in your template files......

:mrgreen:

PostPosted: Sat May 20, 2006 4:46 am
Author: Snake Plissken
I'm confused, have 2.0.19 with security patch 1.03 and a few mods like ..

eMule, PageLoading, LocalLinks

So do I use the premodded files or go through the code changes manually?

PostPosted: Sat May 20, 2006 6:08 am
Author: Master Dwarf
Somebody correct me if I am wrong...

Snake: if you have mods installed, tweaked your portal, added stuff, outside the normal, standard, blase` portal, then you are better off changing the code manually.

If you have the standard IM portal with no mods, then the premodded files can be used without a hitch.

The big reason is that people here are not going to know what mods you have installed and what files had to be altered to get those mods to function properly. If you overwrite something with a premodded file, it may mess up what mods you have implemented and you would have to reinstall them all from scratch. Guess it is up to you, and what you may think is easier.

Re: Release of upgrade for phpbb2.0.20

PostPosted: Thu May 25, 2006 2:50 am
Author: Csicso
Hello!
<img> I thought everything was all right, after upgrading, but today i got
Code: Select all
Warning: Empty regular expression in .../forum/includes/bbcode.php(1162) : regexp code on line 3

this errormessage for at least 30 times on the portal! (portal.php)

Can anybody help me to vanquish that?

PostPosted: Thu May 25, 2006 8:37 am
Author: Master Dwarf
Csicso: Can you post the contents of your /forum/includes/bbcode.php as a quote so we can take a look and see what may be amuck?

Re: Release of upgrade for phpbb2.0.20

PostPosted: Fri May 26, 2006 2:30 am
Author: Csicso
Ok, here you are, i think tis is the one that i downloaded form here..

(Edited for 5 times)

Sorry for doing this, but i dont know how to quote the whole..

[code]
<?php
// -------------------------------------------------------------
//
// $Id: ---- $
//
// FILENAME : index.php
// STARTED : Sat Feb 13, 2001
// COPYRIGHT : ÂÂÂ © 2001, 2005 phpBB Group
// WWW : http://www.phpbb.com/
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
//
// -------------------------------------------------------------

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

define("BBCODE_UID_LEN", 10);

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

$bbcode_tpl = null;

/**
* 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
* are the associated template.
* Probably pukes all over the place if there's something really screwed
* with the bbcode.tpl file.
*
* Nathan Codding, Sept 26 2001.
*/
function load_bbcode_template()
{
global $template;
$tpl_filename = $template->make_filename('bbcode.tpl');
$tpl = fread(fopen($tpl_filename, 'r'), filesize($tpl_filename));

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

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

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

$bbcode_tpls = array();

eval($tpl);

return $bbcode_tpls;
}


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

$bbcode_tpl['olist_open'] = str_replace('{LIST_TYPE}', '\1', $bbcode_tpl['olist_open']);

$bbcode_tpl['color_open'] = str_replace('{COLOR}', '\1', $bbcode_tpl['color_open']);

$bbcode_tpl['size_open'] = str_replace('{SIZE}', '\1', $bbcode_tpl['size_open']);

$bbcode_tpl['quote_open'] = str_replace('{L_QUOTE}', $lang['Quote'], $bbcode_tpl['quote_open']);

$bbcode_tpl['quote_username_open'] = str_replace('{L_QUOTE}', $lang['Quote'], $bbcode_tpl['quote_username_open']);
$bbcode_tpl['quote_username_open'] = str_replace('{L_WROTE}', $lang['wrote'], $bbcode_tpl['quote_username_open']);
$bbcode_tpl['quote_username_open'] = str_replace('{USERNAME}', '\1', $bbcode_tpl['quote_username_open']);

$bbcode_tpl['quote_post_open'] = str_replace('{L_QUOTE}', $lang['Quote'], $bbcode_tpl['quote_post_open']);
$temp_url = append_sid('show_post.php?p=\1');
$bbcode_tpl['quote_post_open'] = str_replace('{U_VIEW_POST}', '<a>' . $lang['View_post'] . '</a>', $bbcode_tpl['quote_post_open']);

$bbcode_tpl['quote_username_post_open'] = str_replace('{L_QUOTE}', $lang['Quote'], $bbcode_tpl['quote_username_post_open']);
$bbcode_tpl['quote_username_post_open'] = str_replace('{L_WROTE}', $lang['wrote'], $bbcode_tpl['quote_username_post_open']);
$bbcode_tpl['quote_username_post_open'] = str_replace('{USERNAME}', '\1', $bbcode_tpl['quote_username_post_open']);
$temp_url = append_sid('show_post.php?p=\2');
$bbcode_tpl['quote_username_post_open'] = str_replace('{U_VIEW_POST}', '<a>' . $lang['View_post'] . '</a>', $bbcode_tpl['quote_username_post_open']);

$bbcode_tpl['code_open'] = str_replace('{L_CODE}', $lang['Code'], $bbcode_tpl['code_open']);
$bbcode_tpl['php_open'] = str_replace('{L_PHP}', $lang['PHPCode'], $bbcode_tpl['php_open']); // PHP MOD

$bbcode_tpl['img'] = str_replace('{URL}', '\1', $bbcode_tpl['img']);
$bbcode_tpl['imgrel'] = str_replace('{URL}', '\1', $bbcode_tpl['imgrel']);
$bbcode_tpl['theme'] = str_replace('{URL}', $current_template_path . '/\1', $bbcode_tpl['theme']);

//BBCode Search Mod
$bbcode_tpl['search'] = str_replace('{KEYWORD}', '\1', $bbcode_tpl['search']);

// LEFT-RIGHT-start
$bbcode_tpl['left'] = str_replace('{URL}', '\1', $bbcode_tpl['left']);
$bbcode_tpl['right'] = str_replace('{URL}', '\1', $bbcode_tpl['right']);
$bbcode_tpl['themeleft'] = str_replace('{URL}', $current_template_path . '/\1', $bbcode_tpl['themeleft']);
$bbcode_tpl['themeright'] = str_replace('{URL}', $current_template_path . '/\1', $bbcode_tpl['themeright']);
$bbcode_tpl['relleft'] = str_replace('{URL}', '\1', $bbcode_tpl['relleft']);
$bbcode_tpl['relright'] = str_replace('{URL}', '\1', $bbcode_tpl['relright']);
// LEFT-RIGHT-end

// We do URLs in several different ways..
$bbcode_tpl['url1'] = str_replace('{URL}', '\1', $bbcode_tpl['url']);
$bbcode_tpl['url1'] = str_replace('{DESCRIPTION}', '\1', $bbcode_tpl['url1']);

$bbcode_tpl['url2'] = str_replace('{URL}', 'http://\1', $bbcode_tpl['url']);
$bbcode_tpl['url2'] = str_replace('{DESCRIPTION}', '\1', $bbcode_tpl['url2']);

$bbcode_tpl['url3'] = str_replace('{URL}', '\1', $bbcode_tpl['url']);
$bbcode_tpl['url3'] = str_replace('{DESCRIPTION}', '\2', $bbcode_tpl['url3']);

$bbcode_tpl['url4'] = str_replace('{URL}', 'http://\1', $bbcode_tpl['url']);
$bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\3', $bbcode_tpl['url4']);

$bbcode_tpl['email'] = str_replace('{EMAIL}', '\1', $bbcode_tpl['email']);

$bbcode_tpl['acronym_open'] = str_replace('{DESCRIPTION}', '\1', $bbcode_tpl['acronym_open']);

$bbcode_tpl['google'] = ''' . $bbcode_tpl['google'] . ''';
$bbcode_tpl['google'] = str_replace('{STRING}', "' . str_replace('"', '"', '\1') . '", $bbcode_tpl['google']);
$bbcode_tpl['google'] = str_replace('{QUERY}', "' . urlencode(str_replace('"', '"', '\1')) . '", $bbcode_tpl['google']);

global $userdata;
$bbcode_tpl['you'] = str_replace('{YOU}', '"' . $userdata['username'] . '"', $bbcode_tpl['you']);

// bbcode_box Mod
$bbcode_tpl['align_open'] = str_replace('{ALIGN}', '\1', $bbcode_tpl['align_open']);
$bbcode_tpl['stream'] = str_replace('{URL}', '\1', $bbcode_tpl['stream']);
$bbcode_tpl['ram'] = str_replace('{URL}', '\1', $bbcode_tpl['ram']);
$bbcode_tpl['marq_open'] = str_replace('{MARQ}', '\1', $bbcode_tpl['marq_open']);
$bbcode_tpl['table_open'] = str_replace('{TABLE}', '\1', $bbcode_tpl['table_open']);
$bbcode_tpl['cell_open'] = str_replace('{CELL}', '\1', $bbcode_tpl['cell_open']);
$bbcode_tpl['web'] = str_replace('{URL}', '\1', $bbcode_tpl['web']);
$bbcode_tpl['flash'] = str_replace('{WIDTH}', '\1', $bbcode_tpl['flash']);
$bbcode_tpl['flash'] = str_replace('{HEIGHT}', '\2', $bbcode_tpl['flash']);
$bbcode_tpl['flash'] = str_replace('{URL}', '\3', $bbcode_tpl['flash']);
$bbcode_tpl['video'] = str_replace('{URL}', '\3', $bbcode_tpl['video']);
$bbcode_tpl['video'] = str_replace('{WIDTH}', '\1', $bbcode_tpl['video']);
$bbcode_tpl['video'] = str_replace('{HEIGHT}', '\2', $bbcode_tpl['video']);
$bbcode_tpl['font_open'] = str_replace('{FONT}', '\1', $bbcode_tpl['font_open']);
$bbcode_tpl['poet_open'] = str_replace('{POET}', '\1', $bbcode_tpl['poet_open']);
// bbcode_box Mod

define("BBCODE_TPL_READY", true);

return $bbcode_tpl;
}


/**
* Does second-pass bbencoding. This should be used before displaying the message in
* a thread. Assumes the message is already first-pass encoded, and we are given the
* correct UID as used in first-pass encoding.
*/
function bbencode_second_pass($text, $uid)
{
global $lang, $bbcode_tpl;

$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\1:", $text);

// pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0).
// This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it.
$text = " " . $text;

// First: If there isn't a "[" and a "]" in the message, don't bother.
if (! (strpos($text, "[") && strpos($text, "]")) )
{
// Remove padding, return.
$text = substr($text, 1);
return $text;
}

// Only load the templates ONCE..
if (!defined("BBCODE_TPL_READY"))
{
// load templates from file into array.
$bbcode_tpl = load_bbcode_template();

// prepare array for use in regexps.
$bbcode_tpl = prepare_bbcode_template($bbcode_tpl);
}

// [code] and [/code] for posting code (HTML, PHP, C etc etc) in your posts.
$text = bbencode_second_pass_code($text, $uid, $bbcode_tpl);

// PHP MOD
// /*php and /php*/ for posting PHP code in your posts.
$text = bbencode_second_pass_php($text, $uid, $bbcode_tpl);

//
and
for posting replies with quote, or just for quoting stuff.
$text = str_replace("
", $bbcode_tpl['quote_open'], $text);
$text = str_replace("
", $bbcode_tpl['quote_close'], $text);

// opening a quote with an pre-defined post entry
$text = preg_replace("/
+)"]/si", $bbcode_tpl['quote_post_open'], $text);

// opening a username quote with an pre-defined post entry
$text = preg_replace("/
*)"?);p=(?:"?([0-9]+)"?)]/si", $bbcode_tpl['quote_username_post_open'], $text);

// New one liner to deal with opening quotes with usernames...
// replaces the two line version that I had here before..
$text = preg_replace("/
/si", $bbcode_tpl['quote_username_open'], $text);

// acronym
$text = preg_replace("/[acronym:$uid="(.*?)"]/si", $bbcode_tpl['acronym_open'], $text);
$text = str_replace("[/acronym:$uid]", $bbcode_tpl['acronym_close'], $text);

//
    and [list type=x] for (un)ordered lists.
    // unordered lists
    $text = str_replace("
      ", $bbcode_tpl['ulist_open'], $text);
      // li tags
      $text = str_replace("
    • ", $bbcode_tpl['listitem'], $text);
      // ending tags
      $text = str_replace("
    ", $bbcode_tpl['ulist_close'], $text);
    $text = str_replace("
", $bbcode_tpl['olist_close'], $text);
// Ordered lists
$text = preg_replace("/[list type=([a1])]/si", $bbcode_tpl['olist_open'], $text);

// colors
$text = preg_replace("/[color=(#[0-9A-F]{6}|[a-z]+)]/si", $bbcode_tpl['color_open'], $text);
$text = str_replace("[/color]", $bbcode_tpl['color_close'], $text);

// size
$text = preg_replace("/[size=99px]/si", $bbcode_tpl['size_open'], $text);
$text = str_replace("[/size]", $bbcode_tpl['size_close'], $text);

// and for bolding text.
$text = str_replace("", $bbcode_tpl['b_open'], $text);
$text = str_replace("
", $bbcode_tpl['b_close'], $text);

// [sup] and [/sup] pour les textes en exposant.
$text = str_replace("[sup:$uid]", $bbcode_tpl['sup_open'], $text);
$text = str_replace("[/sup:$uid]", $bbcode_tpl['sup_close'], $text);

// [sub] and [/sub] pour les textes en indice.
$text = str_replace("[sub:$uid]", $bbcode_tpl['sub_open'], $text);
$text = str_replace("[/sub:$uid]", $bbcode_tpl['sub_close'], $text);

// [strike] and [/strike] for barring text.
$text = str_replace("[strike:$uid]", $bbcode_tpl['strike_open'], $text);
$text = str_replace("[/strike:$uid]", $bbcode_tpl['strike_close'], $text);

// and for underlining text.
$text = str_replace("", $bbcode_tpl['u_open'], $text);
$text = str_replace("
", $bbcode_tpl['u_close'], $text);

// and for italicizing text.
$text = str_replace("", $bbcode_tpl['i_open'], $text);
$text = str_replace("
", $bbcode_tpl['i_close'], $text);

// Patterns and replacements for URL and email tags..
$patterns = array();
$replacements = array();

// [img]image_url_here[/img] code..
// This one gets first-passed..
//-- mod : profile cp ------------------------------------------------------------------------------
//-- add
global $userdata;

if (!$userdata['user_viewimg'])
{
$text = str_replace("[img]", "", $text);
$text = str_replace("[/img]", "", $text);
$text = str_replace("[img=left:$uid]", "", $text);
$text = str_replace("[img=right:$uid]", "", $text);
$text = str_replace("[imgrel:$uid]", "", $text);
$text = str_replace("[/imgrel:$uid]", "", $text);
$text = str_replace("[imgrel=left:$uid]", "", $text);
$text = str_replace("[imgrel=right:$uid]", "", $text);
$text = str_replace("[theme:$uid]", "", $text);
$text = str_replace("[theme=left:$uid]", "", $text);
$text = str_replace("[theme=right:$uid]", "", $text);
$text = str_replace("[/theme:$uid]", "", $text);
}
//-- fin mod : profile cp --------------------------------------------------------------------------

$patterns[] = "#[img]([^?](?:[^[]+|[(?!url))*?)[/img]#i";
$replacements[] = $bbcode_tpl['img'];

//BBCode Search Mod
$patterns[] = "#[search:$uid](.*?)[/search:$uid]#si";
$replacements[] = $bbcode_tpl['search'];

$patterns[] = "#[theme:$uid](.*?)[/theme:$uid]#si";
$replacements[] = $bbcode_tpl['theme'];

$patterns[] = "#[imgrel:$uid](.*?)[/imgrel:$uid]#si";
$replacements[] = $bbcode_tpl['img'];

// LEFT-RIGHT-start
// [img=left]image_url_here[/img] code..
$patterns[] = "#[img=left:$uid](.*?)[/img]#si";
$replacements[] = $bbcode_tpl['left'];

// [img=right]image_url_here[/img] code..
$patterns[] = "#[img=right:$uid](.*?)[/img]#si";
$replacements[] = $bbcode_tpl['right'];

// [imgrel=left]image_url_here[/imgrel] code..
$patterns[] = "#[imgrel=left:$uid](.*?)[/imgrel:$uid]#si";
$replacements[] = $bbcode_tpl['relleft'];

// [img=right]image_url_here[/img] code..
$patterns[] = "#[imgrel=right:$uid](.*?)[/imgrel:$uid]#si";
$replacements[] = $bbcode_tpl['relright'];

// [img=left]image_url_here[/img] code..
$patterns[] = "#[theme=left:$uid](.*?)[/theme:$uid]#si";
$replacements[] = $bbcode_tpl['themeleft'];

// [img=right]image_url_here[/img] code..
$patterns[] = "#[theme=right:$uid](.*?)[/theme:$uid]#si";
$replacements[] = $bbcode_tpl['themeright'];
// LEFT-RIGHT-end

// matches a xxxx://www.phpbb.com code..
$patterns[] = "#[url]([w]+?://([w#$%&~/.-;:=,?@]+]+|[(?!url=))*?)[/url]#is";

$replacements[] = $bbcode_tpl['url1'];

// http://www.phpbb.com code.. (no xxxx:// prefix).
$patterns[] = "#[url]((www|ftp).([w#$%&~/.-;:=,?@]+]+|[(?!url=))*?)[/url]#is";

$replacements[] = $bbcode_tpl['url2'];

// [url=xxxx]phpBB[/url] code..
$patterns[] = "#[url=([w]+?]+]*?)]([^?nrt].*?)[/url]#is";
$replacements[] = $bbcode_tpl['url3'];

// phpBB code.. (no xxxx] = "#[url=((www|ftp).[w#$%&~/.-;]+]*?)]([^?nrt].*?)[/url]#is";
$replacements[] = $bbcode_tpl['url4'];

// user@domain.tld code..
$patterns[] = "#[email]([a-z0-9&-_.]+?@[w-]+.([w-.]+.)?[w]+)[/email]#si";
$replacements[] = $bbcode_tpl['email'];

// [google]string for search[/google] code..
$patterns[] = "#[google](.*?)[/google]#ise";
$replacements[] = $bbcode_tpl['google'];

// [you] - inserts the name of the person viewing the post
$patterns[] = "#[you]#ise";
$replacements[] = $bbcode_tpl['you'];

// bbcode_box Mod
// [fade] and [/fade] for faded text.
$text = str_replace("[fade:$uid]", $bbcode_tpl['fade_open'], $text);
$text = str_replace("[/fade:$uid]", $bbcode_tpl['fade_close'], $text);
// real
$patterns[] = "#[ram:$uid](.*?)[/ram:$uid]#si";
$replacements[] = $bbcode_tpl['ram'];
// sound
$patterns[] = "#[stream:$uid](.*?)[/stream:$uid]#si";
$replacements[] = $bbcode_tpl['stream'];
//web
$patterns[] = "#[web:$uid](.*?)[/web:$uid]#si";
$replacements[] = $bbcode_tpl['web'];
// [flash width= height= loop= ] and [/flash] code..
$patterns[] = "#[flash width=([0-6]?[0-9]?[0-9]) height=([0-4]?[0-9]?[0-9]):$uid](.*?)[/flash:$uid]#si";
$replacements[] = $bbcode_tpl['flash'];
// [flash width= height= loop= ] and [/flash] code..
$patterns[] = "#[video width=([0-6]?[0-9]?[0-9]) height=([0-4]?[0-9]?[0-9]):$uid](.*?)[/video:$uid]#si";
$replacements[] = $bbcode_tpl['video'];
$text = preg_replace($patterns, $replacements, $text);
// align
$text = preg_replace("/[align=(left|right|center|justify):$uid]/si", $bbcode_tpl['align_open'], $text);
$text = str_replace("[/align:$uid]", $bbcode_tpl['align_close'], $text);
// marquee
$text = preg_replace("/[marq=(left|right|up|down):$uid]/si", $bbcode_tpl['marq_open'], $text);
$text = str_replace("[/marq:$uid]", $bbcode_tpl['marq_close'], $text);
// table
$text = preg_replace("/[table=(.*?):$uid]/si", $bbcode_tpl['table_open'], $text);
$text = str_replace("[/table:$uid]", $bbcode_tpl['table_close'], $text);
// cell
$text = preg_replace("/[cell=(.*?):$uid]/si", $bbcode_tpl['cell_open'], $text);
$text = str_replace("[/cell:$uid]", $bbcode_tpl['cell_close'], $text);
// center
$text = preg_replace("/[center:$uid]/si", $bbcode_tpl['center_open'], $text);
$text = str_replace("[/center:$uid]", $bbcode_tpl['center_close'], $text);
// font
$text = preg_replace("//si", $bbcode_tpl['font_open'], $text);
$text = str_replace("[/font:$uid]", $bbcode_tpl['font_close'], $text);
// poet
$text = preg_replace("/[poet(.*?):$uid]/si", $bbcode_tpl['poet_open'], $text);
$text = str_replace("[/poet:$uid]", $bbcode_tpl['poet_close'], $text);
//[hr]
$text = str_replace("[hr:$uid]", $bbcode_tpl['hr'], $text);
// bbcode_box Mod

$text = preg_replace($patterns, $replacements, $text);

// Remove our padding from the string..
$text = substr($text, 1);

return $text;

} // bbencode_second_pass()

// Need to initialize the random numbers only ONCE
mt_srand( (double) microtime() * 1000000);

function make_bbcode_uid()
{
// Unique ID for this message..

$uid = dss_rand();
$uid = substr($uid, 0, BBCODE_UID_LEN);

return $uid;
}

function bbencode_first_pass($text, $uid)
{
// pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0).
// This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it.
$text = " " . $text;

// [code] and [/code] for posting code (HTML, PHP, C etc etc) in your posts.
$text = bbencode_first_pass_pda($text, $uid, '[code]', '[/code]', '', true, '');

// PHP MOD
// /*php and /php*/ for posting PHP code in your posts.
$text = bbencode_first_pass_pda($text, $uid, '/*php ', ' /php*/', '', true, '');

//
and
for posting replies with quote, or just for quoting stuff.
$text = bbencode_first_pass_pda($text, $uid, '
', '
', '', false, '');
$text = bbencode_first_pass_pda($text, $uid, '/[quote=(".*?")]/is', '
', '', false, '', "
");
//
and
for posting replies with quote, or just for quoting stuff with an pre-defined post entry
$text = bbencode_first_pass_pda($text, $uid, '/[quote=p=\\&quot;([0-9]+)\\&quot;]/is', '
', '', false, '', "
");

$text = bbencode_first_pass_pda($text, $uid, '/[quote=\\&quot;(.*?)\\&quot;;p=\\&quot;([0-9]+)\\&quot;]/is', '
', '', false, '', "
");
$text = bbencode_first_pass_pda($text, $uid, '/[quote=\\&quot;(.*?)\\&quot;]/is', '
', '', false, '', "[quote]");

// [acronym] and [/acronym]
$text = bbencode_first_pass_pda($text, $uid, '/[acronym=(".*?")]/is', '[/acronym]', '', false, '', "[acronym:$uid=\1]");

//
    and [list type=x] for (un)ordered lists.
    $open_tag = array();
    $open_tag[0] = "
      ";

      // unordered..
      $text = bbencode_first_pass_pda($text, $uid, $open_tag, "
    ", "
", false, 'replace_listitems');

$open_tag[0] = "[list type=decimal]";
$open_tag[1] = "
    ";

    // ordered.
    $text = bbencode_first_pass_pda($text, $uid, $open_tag, "
", "[/list]", false, 'replace_listitems');

// [color] and [/color] for setting text color
$text = preg_replace("#[color=(#[0-9A-F]{6}|[a-z-]+)](.*?)[/color]#si", "[color=\1]\2[/color]", $text);

// [size] and [/size] for setting text size
$text = preg_replace("#[size=99px]\2[/size]", $text);

// and for bolding text.
$text = preg_replace("#(.*?)#si", "\1", $text);

// [sup] and [/sup] pour les textes en exposant.
$text = preg_replace("#[sup](.*?)[/sup]#si", "[sup:$uid]\1[/sup:$uid]", $text);

// [sub] and [/sub] pour les textes en indice.
$text = preg_replace("#[sub](.*?)[/sub]#si", "[sub:$uid]\1[/sub:$uid]", $text);

// [strike] and [/strike] for barring text.
$text = preg_replace("#[strike](.*?)[/strike]#si", "[strike:$uid]\1[/strike:$uid]", $text);

// and for underlining text.
$text = preg_replace("#(.*?)#si", "\1", $text);

// and for italicizing text.
$text = preg_replace("#(.*?)#si", "\1", $text);

// [img]image_url_here[/img] code..
$text = preg_replace("#[img]((http|ftp|https|ftps)://)([^%20?&=#"nrt<]*?(.(jpg|jpeg|gif|png)))[/img]#sie", "'[img]\1'%20.%20str_replace('%20',%20'%20',%20'\3')%20.%20'[/img]'", $text);

//BBCode Search Mod
$text = preg_replace("#[search](.*?)[/search]#si", "[search:$uid]\1[/search:$uid]", $text);

$text = preg_replace("#[theme]([^ ?&=#"nrt<]*?)[/theme]#sie", "'[theme:$uid]\1' . str_replace(' ', '%20', '\3') . '[/theme:$uid]'", $text);
$text = preg_replace("#[theme=left]([^ ?&=#"nrt<]*?)[/theme]#sie", "'[theme=left:$uid]\1' . str_replace(' ', '%20', '\3') . '[/theme:$uid]'", $text);
$text = preg_replace("#[theme=right]([^ ?&=#"nrt<]*?)[/theme]#sie", "'[theme=right:$uid]\1' . str_replace(' ', '%20', '\3') . '[/theme:$uid]'", $text);

$text = preg_replace("#[imgrel]([^ ?&=#"nrt<]*?)[/imgrel]#sie", "'[imgrel:$uid]\1' . str_replace(' ', '%20', '\3') . '[/imgrel:$uid]'", $text);
$text = preg_replace("#[imgrel=left]([^rnt<"]*?)[/imgrel]#sie", "'[imgrel=left:$uid]\1' . str_replace(' ', '%20', '\3') . '[/imgrel:$uid]'", $text);
$text = preg_replace("#[imgrel=right]([^rnt<"]*?)[/imgrel]#sie", "'[imgrel=right:$uid]\1' . str_replace(' ', '%20', '\3') . '[/imgrel:$uid]'", $text);

// LEFT-RIGHT-start
$text = preg_replace("#[img=left]((http|ftp|https|ftps)://)([^rnt<"]*?)[/img]#sie", "'[img=left:$uid]\1' . str_replace(' ', '%20', '\3') . '[/img]'", $text);
$text = preg_replace("#[img=right]((http|ftp|https|ftps)://)([^rnt</img> 0)
{
// There exists a starting tag.
$curr_nesting_depth = sizeof($stack);
// We need to do 2 replacements now.
$match = array_pop($stack);
$start_index = $match['pos'];
$start_tag = $match['tag'];
$start_length = strlen($start_tag);
$start_tag_index = $match['index'];

if ($open_is_regexp)
{
$start_tag = preg_replace($open_tag[$start_tag_index], $open_regexp_replace[$start_tag_index], $start_tag);
}

// everything before the opening tag.
$before_start_tag = substr($text, 0, $start_index);

// everything after the opening tag, but before the closing tag.
$between_tags = substr($text, $start_index + $start_length, $curr_pos - $start_index - $start_length);

// Run the given function on the text between the tags..
if ($use_function_pointer)
{
$between_tags = $func($between_tags, $uid);
}

// everything after the closing tag.
$after_end_tag = substr($text, $curr_pos + $close_tag_length);

// Mark the lowest nesting level if needed.
if ($mark_lowest_level && ($curr_nesting_depth == 1))
{
if ($open_tag[0] == '[code]')
{
$code_entities_match = array('#<code_entities_replace> 0)
{
$match = array_pop($stack);
$curr_pos = $match['pos'];
// bbcode_array_push($stack, $match);
// ++$curr_pos;
}
else
{
$curr_pos = 1;
}
}
else
{
// No matching start tag found. Increment pos, keep going.
++$curr_pos;
}
}
else
{
// No starting tag or ending tag.. Increment pos, keep looping.,
++$curr_pos;
}
}
}
} // while

return $text;

} // bbencode_first_pass_pda()

/**
* Does second-pass bbencoding of the [code] tags. This includes
* running htmlspecialchars() over the text contained between
* any pair of [code] tags that are at the first level of
* nesting. Tags at the first level of nesting are indicated
* by this format: [code] ... [/code]
* Other tags are in this format: [code] ... [/code]
*/
function bbencode_second_pass_code($text, $uid, $bbcode_tpl)
{
global $lang;

$code_start_html = $bbcode_tpl['code_open'];
$code_end_html = $bbcode_tpl['code_close'];

// First, do all the 1st-level matches. These need an htmlspecialchars() run,
// so they have to be handled differently.
$match_count = preg_match_all("#[code](.*?)[/code]#si", $text, $matches);

for ($i = 0; $i < $match_count; $i++)
{
$before_replace = $matches[1][$i];
$after_replace = $matches[1][$i];

// Replace 2 spaces with " " so non-tabbed code indents without making huge long lines.
$after_replace = str_replace(" ", " ", $after_replace);
// now Replace 2 spaces with " " to catch odd #s of spaces.
$after_replace = str_replace(" ", " ", $after_replace);

// Replace tabs with " " so tabbed code indents sorta right without making huge long lines.
$after_replace = str_replace("t", " ", $after_replace);

// now Replace space occurring at the beginning of a line
$after_replace = preg_replace("/^ {1}/m", " ", $after_replace);

$str_to_match = "[code]" . $before_replace . "[/code]";

$replacement = $code_start_html;
$replacement .= $after_replace;
$replacement .= $code_end_html;

$text = str_replace($str_to_match, $replacement, $text);
}

// Now, do all the non-first-level matches. These are simple.
$text = str_replace("[code]", $code_start_html, $text);
$text = str_replace("[/code]", $code_end_html, $text);

return $text;

} // bbencode_second_pass_code()

/**
* PHP MOD
* Original code/function by phpBB Group
* Modified by JW Frazier / Fubonis < xxxx://yyyy with an HTML <a> tag linking
* to that URL
* - Goes through the given string, and replaces http://www.xxxx.yyyy[zzzz] with an HTML <a> tag linking
* to http://www.xxxx.yyyy[/zzzz]
* - Goes through the given string, and replaces xxxx@yyyy with an HTML mailto: tag linking
* to that email address
* - Only matches these 2 patterns either after a space, or at the beginning of a line
*
* Notes: the email one might get annoying - it's easy to make it more restrictive, though.. maybe
* have it require something like <a>xxxx@yyyy.zzzz</a> or such. We'll see.
*/
function make_clickable($text)
{

$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\1:", $text);

// pad it with a space so we can match things at the start of the 1st line.
$ret = ' ' . $text;

// matches an "xxxx://yyyy" URL at the start of a line, or after a space.
// xxxx can only be alpha characters.
// yyyy is anything up to the first space, newline, comma, double quote or <
$ret = preg_replace("#(^|[n ])([w]+?://[w#$%&~/.-;:=,?@[]+]*)#is", "\1<a>\2</a>", $ret);

// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
// Must contain at least 2 dots. xxxx contains either alphanum, or "-"
// zzzz is optional.. will contain everything up to the first space, newline,
// comma, double quote or <.
$ret = preg_replace("#(^|[n ])((www|ftp).[w#$%&~/.-;:=,?@[]+]*)#is", "\1<a>\2</a>", $ret);

// matches an email@domain type address at the start of a line, or after a space.
// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".
$ret = preg_replace("#(^|[n ])([a-z0-9&-_.]+?)@([w-]+.([w-.]+.)*[w]+)#i", "\1<a>\2@\3</a>", $ret);

// Remove our padding..
$ret = substr($ret, 1);

return($ret);
}

/**
* Nathan Codding - Feb 6, 2001
* Reverses the effects of make_clickable(), for use in editpost.
* - Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs.
*
*/
function undo_make_clickable($text)
{
$text = preg_replace("#<BBCode><a>.*?</a><BBCode>#i", "\1", $text);
$text = preg_replace("#<BBcode><a>.*?</a><BBCode>#i", "\1", $text);

return $text;

}

/**
* Nathan Codding - August 24, 2000.
* Takes a string, and does the reverse of the PHP standard function
* htmlspecialchars().
*/
function undo_htmlspecialchars($input)
{
$input = preg_replace("/&gt;/i", ">", $input);
$input = preg_replace("/&lt;/i", "<", $input);
$input = preg_replace("/&quot;/i", """, $input);
$input = preg_replace("/&/i", "&", $input);

return $input;
}

/**
* This is used to change a [*] tag into a [*] tag as part
* of the first-pass bbencoding of [list] tags. It fits the
* standard required in order to be passed as a variable
* function into bbencode_first_pass_pda().
*/
function replace_listitems($text, $uid)
{
$text = str_replace("[*]", "[*]", $text);

return $text;
}

/**
* Escapes the "/" character with "/". This is useful when you need
* to stick a runtime string into a PREG regexp that is being delimited
* with slashes.
*/
function escape_slashes($input)
{
$output = str_replace('/', '/', $input);
return $output;
}

/**
* This function does exactly what the PHP4 function array_push() does
* however, to keep phpBB compatable with PHP 3 we had to come up with our own
* method of doing it.
* This function was deprecated in phpBB 2.0.18
*/
function bbcode_array_push(&$stack, $value)
{
$stack[] = $value;
return(sizeof($stack));
}

/**
* This function does exactly what the PHP4 function array_push() does
* however, to keep phpBB compatable with PHP 3 we had to come up with our own
* method of doing it.
* This function was deprecated in phpBB 2.0.18
*/
function bbcode_array_pop(&$stack)
{
$arrSize = count($stack);
$x = 1;

while(list($key, $val) = each($stack))
{
if($x < count($stack))
{
$tmpArr[] = $val;
}
else
{
$return_val = $val;
}
$x++;
}
$stack = $tmpArr;

return($return_val);
}

//
// Smilies code ... would this be better tagged on to the end of bbcode.php?
// Probably so and I'll move it before B2
//
function smilies_pass($message)
{
static $orig, $repl;

if (!isset($orig))
{
global $db, $board_config, $portal_config, $var_cache;

$orig = $repl = array();

if($portal_config['cache_enabled'])
{
$orig = $var_cache->get('orig2', 86400, 'smilies');
$repl = $var_cache->get('repl2', 86400, 'smilies');
}
if(!$orig)
{
$sql = 'SELECT * FROM ' . SMILIES_TABLE;
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
}
$smilies = $db->sql_fetchrowset($result);

if (count($smilies))
{
usort($smilies, 'smiley_sort');
}

for ($i = 0; $i <count>save($orig, 'orig2', 'smilies');
$var_cache->save($repl, 'repl2', 'smilies');
}
}
}

if (count($orig))
{
$message = preg_replace($orig, $repl, ' ' . $message . ' ');
$message = substr($message, 1, -1);
}

return $message;
}

function acronym_pass($message)
{
static $orig, $repl;

if( !isset($orig) )
{
global $db, $board_config;
$orig = $repl = array();

$sql = 'SELECT * FROM ' . ACRONYMS_TABLE;
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain acronyms data", "", __LINE__, __FILE__, $sql);
}

$acronyms = $db->sql_fetchrowset($result);

if( count($acronyms) )
{
usort( $acronyms, 'acronym_sort' );
}

for ($i = 0; $i </acronym> strlen($b['code']) ) ? -1 : 1;
}

function acronym_sort($a, $b)
{
if ( strlen($a['acronym']) == strlen($b['acronym']) )
{
return 0;
}

return ( strlen($a['acronym']) > strlen($b['acronym']) ) ? -1 : 1;
}
?>
[/code]

PostPosted: Fri May 26, 2006 2:40 am
Author: Csicso
Really sorry, i tried, but i cannot force it, i realy dont know what happened.. <img>

PostPosted: Fri May 26, 2006 4:52 am
Author: Master Dwarf
I'll take a look and see if there is anything outta whack.

Around line 196 things seem a bit strange. The file I have has a comment 'for posting code' it is commented out but yours is not. That's about as far as I looked.

Did you have any mods installed? Did you do the upgrade manually or using premodded files? If you used premodded files AND you did not have any mods installed previous to the upgrade, I would upload a premodded bbcode.php file. Make sense?