Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
JRSweets
Worker
Worker



Joined: Aug 06, 2004
Posts: 192

PostPosted: Sun Sep 19, 2004 4:34 pm Reply with quote

This mod is great however it won't working correctly with bbtonuke 2.0.10 unless this line is commented out of common.php

Code:
  

if (is_array(${$var_prefix . $var . $var_suffix}))
      {
            unset_vars(${$var_prefix . $var . $var_suffix});
            @reset(${$var_prefix . $var . $var_suffix});
      }


Does anyone know how to fix the mod so I don't have to comment that line? It allows you to have a nice signature editor for your users. You can see a preview and use bbcodes like on a post. Using it with bbtonuke 2.0.10 causes it not save/preview the signature when trying to edit it.

Download it from here.
 
View user's profile Send private message
sixonetonoffun
Spouse Contemplates Divorce



Joined: Jan 02, 2003
Posts: 2496

PostPosted: Sun Sep 19, 2004 5:39 pm Reply with quote

This would probably work but leaves it wide open to abuse.
I don't have time to install it and make it better but I'd suggest something to filter those variables in there too before the else line. Maybe?:
htmlspecialchars(${$var_prefix . $var . $var_suffix});

if (is_array(${$var_prefix . $var . $var_suffix}))
{
if ( $userdata['session_logged_in'] && $mode == 'signature' )
}else{
unset_vars(${$var_prefix . $var . $var_suffix});
@reset(${$var_prefix . $var . $var_suffix});
}
}

Otherwise since this change is also in phpbb it is likely the author will patch it to work with the correct code in the near future.

_________________
[b][size=5]openSUSE 11.4-x86 | Linux 2.6.37.1-1.2desktop i686 | KDE: 4.6.41>=4.7 | XFCE 4.8 | AMD Athlon(tm) XP 3000+ | MSI K7N2 Delta-L | 3GB Black Diamond DDR
| GeForce 6200@433Mhz 512MB | Xorg 1.9.3 | NVIDIA 270.30[/size:2b8 
View user's profile Send private message
chatserv
Member Emeritus



Joined: May 02, 2003
Posts: 1389
Location: Puerto Rico

PostPosted: Sun Sep 19, 2004 5:44 pm Reply with quote

The common.php filter is killing one or more variables in that mode, you would need to check if the author has updated it so that it doesn't rely on register_globals being on, in the meantime you could bypass the killing of the vars by adding a line to that code, right after:
Code:
function unset_vars(&$var)

{
   while (list($var_name, $null) = @each($var))
   {

add:
Code:
    if ( ! ( $var_name == 'phpbb_root_path' || $var_name == 'no_page_header' || $var_name == 'phpEx' || $var_name == 'mode' || $var_name == 'id' ) )

I'm guessing it's either $id or $mode, if it still fails try adding other variables present in the mod until you find the correct one.
 
View user's profile Send private message Visit poster's website
JRSweets







PostPosted: Sun Sep 19, 2004 7:29 pm Reply with quote

Thank you guys. I will try your suggestions. I will also check for an updated version that is compatible with phpbb 2.0.10.

RavensScripts
 
JRSweets







PostPosted: Mon Sep 20, 2004 11:23 am Reply with quote

Code:


<?php

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

   // get the board & user settings ...
   $html_status    = ( $userdata['user_allowhtml'] && $board_config['allow_html'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
   $bbcode_status  = ( $userdata['user_allowbbcode'] && $board_config['allow_bbcode']  ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF'];
   $smilies_status = ( $userdata['user_allowsmile'] && $board_config['allow_smilies']  ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];

   $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 ;

   // check and set various parameters
   $params = array('submit' => 'save', 'preview' => 'preview', 'mode' => 'mode');

while (list($var, $param) = @each($params)) {

if (!empty($HTTP_POST_VARS[$param]) || !empty($HTTP_GET_VARS[$param])) {
   $$var = ( !empty($HTTP_POST_VARS[$param]) ) ? $HTTP_POST_VARS[$param] : $HTTP_GET_VARS[$param];
} else {
   $$var = '';
  }
}
   $trim_var_list = array('signature' => 'signature');

while (list($var, $param) = @each($trim_var_list)) {

if (!empty($HTTP_POST_VARS[$param])) {
   $$var = trim($HTTP_POST_VARS[$param]);
  }
}
   $signature = str_replace('<br />', "\n", $signature);

   // if cancel pressed then redirect to the index page
if (isset($HTTP_POST_VARS['cancel'])) {
   $redirect = "index.$phpEx";

   // redirect 2.0.4 only
   redirect(append_sid($redirect, true));

// redirect 2.0.x
//   $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
//   header($header_location . append_sid($redirect, true));
//   exit;

}

$page_title = $lang['Signature'];

include('includes/bbcode.'.$phpEx);
include('includes/functions_post.'.$phpEx);
include('includes/page_header.'.$phpEx);

// save new signature
if ($submit)
{
   $template->assign_block_vars('switch_save_sig', array());

   if ( isset($signature) )
   {

      if ( strlen( $signature ) > $board_config['max_sig_chars'] )
      {
         $save_message = $lang['Signature_too_long'];
      }

      else
      {
      $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
      $signature = prepare_message($signature, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
      $user_id =  $userdata['user_id'];

      $sql = "UPDATE " . USERS_TABLE . "
      SET user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$bbcode_uid'
      WHERE user_id = $user_id";

         if ( !($result = $db->sql_query($sql)) )
         {
            message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
         }

         else
         {
            $save_message = $lang['sig_save_message'];
         }
      }
   }

   else
   {
      message_die(GENERAL_MESSAGE, 'An Error occured while submitting Signature');
   }
}

// catch the submitted message and prepare it for a preview
else if ($preview)
{
   $template->assign_block_vars('switch_preview_sig', array());

   if ( isset($signature) )
   {
      $preview_sig = $signature;

      if ( strlen( $preview_sig ) > $board_config['max_sig_chars'] )
      {
         $preview_sig = $lang['Signature_too_long'];
      }

   else
   {
      $preview_sig = htmlspecialchars(stripslashes($preview_sig));
      $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
      $preview_sig = stripslashes(prepare_message(addslashes(unprepare_message($preview_sig)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid));

      if( $preview_sig != '' )
      {
         if ( $bbcode_on  == 1 ) { $preview_sig = bbencode_second_pass($preview_sig, $bbcode_uid); }
         if ( $bbcode_on  == 1 ) { $preview_sig = bbencode_first_pass($preview_sig, $bbcode_uid); }
         if ( $bbcode_on  == 1 ) { $preview_sig = make_clickable($preview_sig); }
         if ( $smilies_on == 1 ) { $preview_sig = smilies_pass($preview_sig); }

         $preview_sig = '_________________<br />' . $preview_sig;
         $preview_sig = nl2br($preview_sig);
        }

      else
           {
         $preview_sig = $lang['sig_none'];
           }
   }
   }

   else
   {
      message_die(GENERAL_MESSAGE, 'An Error occured while submitting Signature');
   }
}

// read current signature and prepare it for a preview
else if ($mode)
{

   $template->assign_block_vars('switch_current_sig', array());

   $signature_bbcode_uid = $userdata['user_sig_bbcode_uid'];
   $signature = ( $signature_bbcode_uid != '' ) ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid\]/si", ']', $userdata['user_sig']) : $userdata['user_sig'];
   $bbcode_uid = $userdata['user_sig_bbcode_uid'];
   $user_sig = prepare_message($userdata['user_sig'], $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
   if( $user_sig != '' )
   {
      if ( $bbcode_on  == 1 ) { $user_sig = bbencode_second_pass($user_sig, $bbcode_uid); }
      if ( $bbcode_on  == 1 ) { $user_sig = bbencode_first_pass($user_sig, $bbcode_uid); }
      if ( $bbcode_on  == 1 ) { $user_sig = make_clickable($user_sig); }
      if ( $smilies_on == 1 ) { $user_sig = smilies_pass($user_sig); }
      $user_sig = '_________________<br />' . $user_sig;
      $user_sig = nl2br($user_sig);
   }
   else
   {
      $user_sig = $lang['sig_none'];
   }

}

// template
   $template->set_filenames(array(
      'body' => 'profile_signature.tpl'

   ));

   $template->assign_vars(array(

      // added some picĀ“s for a better preview ;)
      'PROFIL_IMG' => '<img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" />',
      'EMAIL_IMG'  => '<img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" />',
      'PM_IMG'     => '<img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" />',
      'WWW_IMG'    => '<img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" />',
      'AIM_IMG'    => '<img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" />',
      'YIM_IMG'    => '<img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" />',
      'MSN_IMG'    => '<img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" />',
      'ICQ_IMG'    => '<img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" />',

      'SIG_SAVE' => $lang['sig_save'],
      'SIG_CANCEL' => $lang['Cancel'],
      'SIG_PREVIEW' => $lang['Preview'],
      'SIG_EDIT' => $lang['sig_edit'],
      'SIG_CURRENT' => $lang['sig_current'],
      'SIG_CURRENT_LINK' => append_sid("profile.$phpEx?mode=signature"),

      'L_SIGNATURE' => $lang['Signature'],
      'L_SIGNATURE_EXPLAIN' => sprintf($lang['Signature_explain'], $board_config['max_sig_chars']),
      'HTML_STATUS' => $html_status,
      'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'),
      'SMILIES_STATUS' => $smilies_status,

      'SIGNATURE' => $signature,
      'CURRENT_PREVIEW' => $user_sig,
      'PREVIEW' => htmlspecialchars(stripslashes($signature)),
      'REAL_PREVIEW' => $preview_sig,
      'SAVE_MESSAGE' => $save_message,

   ));

   $template->pparse('body');

include('includes/page_tail.'.$phpEx);
?>


I found this updated file. The signature mod is included in Nuke Platinum which uses bbtonuke 2.0.10 . They must have updated the file to make it work.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©