FAP CUSTOMIZATION - Allow BBcode In Description


Subject: FAP CUSTOMIZATION - Allow BBcode In Description
Hi, i have a problem with the album_page.php(album_showpage.php).

When i add:
Code: [Download] [Hide] [Select]
if ( $thispic['pic_bbcode_uid'] != '' )
{
$thispic['pic_desc'] = ( $board_config['allow_bbcode'] ) ?
bbencode_second_pass($thispic['pic_desc'], $thispic['pic_bbcode_uid']) :
preg_replace('/:[0-9a-z:]+]/si', ']', $thispic['pic_desc']);
}

i get this error:
Fatal error: Call to undefined function bbencode_second_pass() in /home/virtual/mysite.com/public_html/album_page.php on line 162

I dont have CLoWN's Supercharged Album Pack installed. It was working before so it must be something else. Can anybody help find where the bbencode_second_pass is defined?

Here is the mod:
Code: [Download] [Hide] [Select]
##############################################################
## MOD Title: Allow BBcode in Photo Album MOD description
## MOD Author: cheesypeanut < simonpitfield@frogspawn.org > (Simon
Pitfield) http://www.frogspawn.org
## MOD Description: Allows BBcode in the description field
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 10 Minutes
## Files To Edit: 6
## album_mod/clown_album_functions.php
## album_cat.php
## album_edit.php
## album_showpage.php
## album_upload.php
## templates/subSilver/album_showpage_body.tpl
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for
the
## latest version of this MOD. Downloading this MOD from other sites
could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer
support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## REQUIREMENTS:
## -------------
## This MOD requires Smartor's Photo Album MOD and CLoWN's Supercharged
Album Pack 1
## to both be installed. This MOD also requires an alteration of the
database structure;
## the addition of the field `pic_bbcode_uid` in the `album` table.
##
##############################################################
## MOD History:
##
## 2005-02-22 - Version 1.0.0
## - Initial release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files
Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------------
#
ALTER TABLE `phpbb_album` ADD `pic_bbcode_uid` VARCHAR( 10 ) NOT NULL
AFTER `pic_desc` ;

#
#-----[ OPEN ]------------------------------------------------
#
album_mod/clown_album_functions.php

#
#-----[ FIND ]------------------------------------------------
#
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
}

#
#-----[ AFTER, ADD ]------------------------------------------
#

$html_entities_match = array('#&(?!(#[0-9]+;))#', '#<#', '#>#');
$html_entities_replace = array('&amp;', '&lt;', '&gt;');

$unhtml_specialchars_match = array('#&gt;#', '#&lt;#', '#&quot;#',
'#&amp;#');
$unhtml_specialchars_replace = array('>', '<', '"', '&');

//
// This function will prepare a posted message for
// entry into the database.
//
function prepare_message($message, $html_on, $bbcode_on, $smile_on,
$bbcode_uid = 0)
{
global $board_config, $html_entities_match, $html_entities_replace;

//
// Clean up the message
//
$message = trim($message);

if ($html_on)
{
$allowed_html_tags = split(',', $board_config['allow_html_tags']);

$end_html = 0;
$start_html = 1;
$tmp_message = '';
$message = ' ' . $message . ' ';

while ($start_html = strpos($message, '<', $start_html))
{
$tmp_message .= preg_replace($html_entities_match,
$html_entities_replace, substr($message, $end_html + 1, ($start_html - $end_html - 1)));

if ($end_html = strpos($message, '>', $start_html))
{
$length = $end_html - $start_html + 1;
$hold_string = substr($message, $start_html, $length);

if (($unclosed_open = strrpos(' ' . $hold_string, '<')) != 1)
{
$tmp_message .= preg_replace($html_entities_match,
$html_entities_replace, substr($hold_string, 0, $unclosed_open - 1));
$hold_string = substr($hold_string, $unclosed_open - 1);
}

$tagallowed = false;
for ($i = 0; $i < sizeof($allowed_html_tags); $i++)
{
$match_tag = trim($allowed_html_tags[$i]);
if (preg_match('#^</?' . $match_tag . '[> ]#i', $hold_string))
{
$tagallowed = (preg_match('#^</?' . $match_tag . ' .*?(style[t
]*?=|on[w]+[t ]*?=)#i', $hold_string)) ? false : true;
}
}

$tmp_message .= ($length && !$tagallowed) ?
preg_replace($html_entities_match, $html_entities_replace, $hold_string) : $hold_string;

$start_html += $length;
}
else
{
$tmp_message .= preg_replace($html_entities_match,
$html_entities_replace, substr($message, $start_html, strlen($message)));

$start_html = strlen($message);
$end_html = $start_html;
}
}

if (!$end_html || ($end_html != strlen($message) && $tmp_message !=
''))
{
$tmp_message .= preg_replace($html_entities_match,
$html_entities_replace, substr($message, $end_html + 1));
}

$message = ($tmp_message != '') ? trim($tmp_message) :
trim($message);
}
else
{
$message = preg_replace($html_entities_match, $html_entities_replace,
$message);
}

if($bbcode_on && $bbcode_uid != '')
{
$message = bbencode_first_pass($message, $bbcode_uid);
}

return $message;
}


#
#-----[ OPEN ]------------------------------------------------
#
album_cat.php

#
#-----[ FIND ]------------------------------------------------
#
$template->assign_block_vars('picrow.piccol', array(
'U_PIC' => ($album_config['fullpic_popup']) ?
append_sid("album_pic.$phpEx?pic_id=". $picrow[$j]['pic_id']) :
append_sid("album_showpage.$phpEx?pic_id=". $picrow[$j]['pic_id']),
'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=".
$picrow[$j]['pic_id']),
'DESC' => $picrow[$j]['pic_desc'],
'APPROVAL' => $approval_link,
)
);

#
#-----[ BEFORE, ADD ]------------------------------------------
#

$picrow[$j]['pic_desc'] =
preg_replace('/[img:[a-z0-9]{10,}].*?[/img:[a-z0-9]{10,}]/', '', $picrow[$j]['pic_desc']);
$picrow[$j]['pic_desc'] = preg_replace('/[/?url(=.*?)?]/', '',
$picrow[$j]['pic_desc']);
$picrow[$j]['pic_desc'] =
preg_replace('/[/?[a-z*=+-]+(:?[0-9a-z]+)?:[a-z0-9]{10,}(:[a-z0-9]+)?=?.*?]/', '',
$picrow[$j]['pic_desc']);

#
#-----[ OPEN ]------------------------------------------------
#
album_edit.php

#
#-----[ FIND ]------------------------------------------------
#
include($phpbb_root_path . 'common.'.$phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);

#
#-----[ FIND ]------------------------------------------------
#
$template->set_filenames(array(
'body' => 'album_edit_body.tpl')
);

#
#-----[ AFTER, ADD ]------------------------------------------
#

if ( $thispic['pic_bbcode_uid'] != '' )
{
$thispic['pic_desc'] = preg_replace('/:(([a-z0-9]:)?)' .
$thispic['pic_bbcode_uid'] . '/s', '', $thispic['pic_desc']);
}

#
#-----[ FIND ]------------------------------------------------
#
$pic_title = str_replace("'", "''",
htmlspecialchars(trim($HTTP_POST_VARS['pic_title'])));

#
#-----[ AFTER, ADD ]------------------------------------------
#

$html_on = ( $userdata['user_allowhtml'] &&
$board_config['allow_html'] ) ? 1 : 0 ;
$bbcode_on = ( $userdata['user_allowbbcode'] &&
$board_config['allow_bbcode'] ) ? 1 : 0 ;
$smilies_on = ( $userdata['user_allowsmile'] &&
$board_config['allow_smilies'] ) ? 1 : 0 ;

#
#-----[ FIND ]------------------------------------------------
#
$pic_desc = str_replace("'", "''",
htmlspecialchars(substr(trim($HTTP_POST_VARS['pic_desc']), 0, $album_config['desc_length'])));

#
#-----[ AFTER, ADD ]------------------------------------------
#

$bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
$pic_desc = prepare_message($pic_desc, $html_on, $bbcode_on,
$smilies_on, $bbcode_uid);

#
#-----[ FIND ]------------------------------------------------
#
SET pic_title = '$pic_title', pic_desc= '$pic_desc'

#
#-----[ INLINE, FIND ]------------------------------------------
#
, pic_desc= '$pic_desc'

#
#-----[ AFTER, ADD ]------------------------------------------------
#
, pic_bbcode_uid = '$bbcode_uid'

#
#-----[ OPEN ]------------------------------------------------
#
album_showpage.php

#
#-----[ FIND ]------------------------------------------------
#
if( empty($thispic) )
{
message_die(GENERAL_ERROR, $lang['Pic_not_exist'] . ' -> ' . $pic_id);
}

#
#-----[ AFTER, ADD ]------------------------------------------
#
if ( $thispic['pic_bbcode_uid'] != '' )
{
$thispic['pic_desc'] = ( $board_config['allow_bbcode'] ) ?
bbencode_second_pass($thispic['pic_desc'], $thispic['pic_bbcode_uid']) :
preg_replace('/:[0-9a-z:]+]/si', ']', $thispic['pic_desc']);
}

#
#-----[ OPEN ]------------------------------------------------
#
#
album_upload.php

#
#-----[ FIND ]------------------------------------------------
#
include($phpbb_root_path . 'common.'.$phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);

#
#-----[ FIND ]------------------------------------------------
#
$pic_title = str_replace("'", "''",
htmlspecialchars(trim($HTTP_POST_VARS['pic_title'])));

#
#-----[ AFTER, ADD ]------------------------------------------
#

$html_on = ( $userdata['user_allowhtml'] &&
$board_config['allow_html'] ) ? 1 : 0 ;
$bbcode_on = ( $userdata['user_allowbbcode'] &&
$board_config['allow_bbcode'] ) ? 1 : 0 ;
$smilies_on = ( $userdata['user_allowsmile'] &&
$board_config['allow_smilies'] ) ? 1 : 0 ;

#
#-----[ FIND ]------------------------------------------------
#
$pic_desc = str_replace("'", "''",
htmlspecialchars(substr(trim($HTTP_POST_VARS['pic_desc']), 0, $album_config['desc_length'])));

#
#-----[ AFTER, ADD ]------------------------------------------
#

$bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
$pic_desc = prepare_message($pic_desc, $html_on, $bbcode_on,
$smilies_on, $bbcode_uid);

#
#-----[ FIND ]------------------------------------------------
#
$sql = "INSERT INTO ". ALBUM_TABLE ." (pic_filename, pic_thumbnail,
pic_title, pic_desc, pic_user_id, pic_user_ip, pic_username, pic_time,
pic_cat_id, pic_approval)

#
#-----[ INLINE, FIND ]------------------------------------------
#
, pic_desc

#
#-----[ AFTER, ADD ]------------------------------------------------
#
, pic_bbcode_uid

#
#-----[ FIND ]------------------------------------------------
#
VALUES ('$pic_filename', '$pic_thumbnail', '$pic_title',
'$pic_desc', '$pic_user_id', '$pic_user_ip', '$pic_username', '$pic_time',
'$cat_id', '$pic_approval')";

#
#-----[ INLINE, FIND ]------------------------------------------
#
, '$pic_desc'

#
#-----[ AFTER, ADD ]------------------------------------------------
#
, '$bbcode_uid'

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/album_showpage_body.tpl

#
#-----[ FIND ]------------------------------------------------
#
<td valign="top"><b><span class="genmed">{PIC_DESC}</span></b></td>

#
#-----[ REPLACE WITH ]-----------------------------------------
#
<td valign="top"><span class="genmed">{PIC_DESC}</span></td>

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM

Profile PM  
Subject: Re: Allow BBcode In Description
thomastoget wrote: [View Post]
...
I dont have CLoWN's Supercharged Album Pack installed. It was working before so it must be something else. Can anybody help find where the bbencode_second_pass is defined?

## REQUIREMENTS:
## -------------
## This MOD requires Smartor's Photo Album MOD and CLoWN's Supercharged
Album Pack 1

## to both be installed. This MOD also requires an alteration of the
database structure;
## the addition of the field `pic_bbcode_uid` in the `album` table.
##
##############################################################


It was working before what ? .... what changed?

This Mod, as written, is not compatible with FAP

Profile PM  
Subject: Re: Allow BBcode In Description
I dont have a "clean" FAP but smartors album v2 plus some bits from FAP, Clowns sp-1 and Minc over at Smartor made some cool stuff for me. I love my modded album and will try a bit more before i start a new clean install. I want the bbcodes back... 0060 As said it did work. I dont know when it stopped.. One of my members told me last week. Can be some server-upgrade-bug..
I have backup of all the files changed in every step but it seems like it wont work with the old files either now. I need to figgure out this error.. If somebody has any tip to guide me in the right direction i appreciate it a lot! Thank you.

FAP and Smartors album are more or less the same mod you know.. I will post the solution here when i figgure it out..

Profile PM  

Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 0.5743s (PHP: 3% SQL: 97%)
SQL queries: 13 - Debug Off - GZIP Enabled