Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Error unserialize() [function.unserialize]: Error at offset 54 of 134 bytes in
Vaz
New
EDIT
Sorry for this post - i've found out the solution. I had to get my member to re-create her signature. She had some odd characters in there before.
--------
Hi, I just moved my forum to a new host. One of my members reported recieving the following error:
Notice: unserialize() [function.unserialize]: Error at offset 54 of 134 bytes in /home/.pilar/vbunet/thevbushow.com/forums/extensions/Signatures/default.php on line 74
=====================================
default.php code is as follows
=======================================
<?php
/*
Extension Name: Signatures
Extension Url: sirnot@gmail.com
Description: Enables each user to have a small, one-line signature.
Version: 1.0.1
Author: SirNotAppearingOnThisForum
Author Url: sirnot@gmail.com
*/
/*
A small modification is needed to make this work:
1. Open up themes/comments.php
2. Find the line:
$CommentList .= $Comment->Body.'
3. Replace the found line with this one:
$CommentList .= $Comment->Body.(defined('EXTENSION_IN_SIGNATURES') ? SignatureRender(@$Row['AuthUserPrefs']) : '').'
4. Enjoy
*/
define('EXTENSION_IN_SIGNATURES', 1);
define('MAX_SIGNATURE_LEN', 200); //in chars
if(isset($Head)) $Head->AddStyleSheet('extensions/Signatures/style.css');
if(!isset($Context->Session->User->Preferences['ShowSigs'])) $Context->Session->User->Preferences['ShowSigs'] = 1; //set default
//thankfully vanilla will do all of the UI for the preferences for us..
$Context->Configuration['PREFERENCE_ShowSigs'] = 1;
$Context->Configuration['CUSTOMIZATION_SIGNATURE'] = '';
$Context->Dictionary['CUSTOMIZATION_SIGNATURE'] = 'Custom Signature';
$Context->Dictionary['CUSTOMIZATION_SIGNATURE_DESCRIPTION'] = 'Displays a small, one-line signature under each of your posts (max chars = '.MAX_SIGNATURE_LEN.'). You may use [url=http://...]linky[/url] to create links.';
$Context->Dictionary['ShowSigs'] = 'Show signatures in comments';
//hooks
$Context->AddToDelegate('CommentManager', 'CommentBuilder_PreWhere', 'Signatures_CommentBuilder');
$Context->AddToDelegate('PreferencesForm', 'Constructor', 'Signatures_Preferences');
$Context->AddToDelegate('Menu', 'PreHeadRender', 'NoFunc');
function NoFunc(&$F)
{
echo('<b></b>');
}
function Signatures_CommentBuilder(&$CommentBuilder)
{
$CommentBuilder->DelegateParameters['SqlBuilder']->AddSelect('Preferences', 'a', 'AuthUserPrefs');
}
function Signatures_Preferences(&$Prefs)
{
if($Prefs->IsPostBack) $Prefs->AddPreference('DiscussionIndex', 'ShowSigs', 'ShowSigs');
}
//helper functions
function Signatures_ParseUrl($Url)
{
$AllowedProtocols = array('http', 'https', 'ftp', 'gopher', 'irc');
$DefProtocol = 'http';
$Parts = explode(':', $Url);
if(count($Parts) > 1 && in_array(strtolower($Parts[0]), $AllowedProtocols)) $Out = $Url;
else $Out = $DefProtocol.'://'.$Url;
return str_replace(' ', '%20', $Out);
}
function SignatureRender($UserPrefs)
{
if($GLOBALS['Context']->Session->User->RoleID &&
!$GLOBALS['Context']->Session->User->Preferences['ShowSigs']) return '';
if(empty($UserPrefs)) return '';
$UserPrefs = unserialize($UserPrefs);
if(isset($UserPrefs['SIGNATURE'])) $Text = $UserPrefs['SIGNATURE'];
else return '';
$Text = htmlspecialchars(substr($Text, 0, MAX_SIGNATURE_LEN));
//$Text = preg_replace("/\[url=(.+?)\](.+?)\[\/url\]/ie", '\'<a href="\'.Signatures_ParseUrl(\'\\1\').\'">\\2</a>\'', $Text);
$Text = preg_replace(
array(
"/\[url=(.+?)\](.+?)\[\/url\]/ie",
"/\[img\](.+?)\[\/img\]/ie"
), array('\'<a
href="\'.Signatures_ParseUrl(\'\\1\').\'">\\2</a>\'',
'\'<img src="\'.Signatures_ParseUrl(\'\\1\').\'" alt="">\''
), $Text
);
return '<span class="CommentSignature">'.$Text.'</span>';
}
?>
======================
does anybody know what might be up?
0
This discussion has been closed.