Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's RavenNuke(tm) v2.00.00 - v2.02.00 Distro
Author Message
Duncan
New Member
New Member



Joined: Dec 21, 2005
Posts: 21

PostPosted: Tue Jan 31, 2006 1:44 pm Reply with quote

Hi all,

I'm a relative noob at this compared to some of you lot, so forgive me for my lack of html/php expertise. I'm having a problem with a Church website I run. Not sure if it is the right place to raise this - but here goes....

I have been using Nuke for a while now with ApproveMembership7.6-(with chatserv 3.1 changes) and various other mods with no problem. Admins are used to it, as am I, and I like the easy way to allow admins to allow or dissalow membership, add required fields, and also have a follow up email, rejection email etc easily sent.

After upgrading to RNuke1.5 no problem with me integrating Approvemembership in, all working fine. The upgrade to 2.02 went ok to, but there seems to be a problem with avatars in the forum profile once I have tried to integrate the Approve membership into it. There seem to have been a few changes in the 2.02 Your_Account module.

../modules.php?name=Your_Account&op=avatarlist displays OK.

Going here - ../modules.php?name=Forums&file=profile&mode=editprofile - and clicking on 'Show gallery' to go to here - ../modules.php?name=Forums&file=profile - gives me a list of similar errors (sitename edited out):-

Quote:
Warning: Missing argument 35 for display_avatar_gallery() in /home/....../public_html/includes/usercp_avatar.php on line 338

Warning: Missing argument 36 for display_avatar_gallery() in /home/....../public_html/includes/usercp_avatar.php on line 338

Warning: Missing argument 37 for display_avatar_gallery() in /home/....../public_html/includes/usercp_avatar.php on line 338

Warning: Missing argument 38 for display_avatar_gallery() in /home/....../public_html/includes/usercp_avatar.php on line 338

Warning: Missing argument 39 for display_avatar_gallery() in /home/....../public_html/includes/usercp_avatar.php on line 338

Warning: Missing argument 40 for display_avatar_gallery() in /home/....../public_html/includes/usercp_avatar.php on line 338

Warning: Missing argument 41 for display_avatar_gallery() in /home/....../public_html/includes/usercp_avatar.php on line 338

etc......... to.....

Warning: Missing argument 81 for display_avatar_gallery() in /home/....../public_html/includes/usercp_avatar.php on line 338


Warning: Missing argument 82 for display_avatar_gallery() in /home/....../public_html/includes/usercp_avatar.php on line 338


What on earth have I done wrong? I'm at my whits end and need a real expert to help me. Any chance one of you can have a look over what I have done and tell me where I have gone wrong?

I use Beyond Compare to compare changes from RN2.02 ../includes/usercp_avatar.php to the Approve Membership version - which i think is the problem (tell me if I'm wrong here).

Code:


Approve Membership version:-

<?php
# $Author: chatserv $
# $Date: 2004/10/07 17:34:44 $
/***************************************************************************
 *                             usercp_avatar.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : [ Only registered users can see links on this board! Get registered or login! ]
 *
 *   Id: usercp_avatar.php,v 1.8.2.21 2005/07/19 20:01:16 acydburn Exp
 *
 *
 ***************************************************************************/
 
/***************************************************************************
 *
 *   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
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 ***************************************************************************/
/*                                                                      */
/* Add_Fields Version 4.0                                               */
/*                                                                      */
/* Allows administrators to add up to 5 admin defined text fields to    */
/* the registration form. Admin can define the name, size and maxlength */
/* of each field and whether the field is activated or not.             */
/*                                                                      */
/* Allows administrators to add up to 4 admin defined select boxes to   */
/* the registration form. Admin can define the name, options and the    */
/* default option of each box and whether the box is activated or not.  */
/*                                                                      */
/* Admin can choose whether text fields are Required or Optional.       */
/* Admin can allow the member to turn off the fields for public         */
/* viewing. Admin can allow the fields to be shown in the Members List. */
/* Admin can choose whether each field is for public view or for admins */
/* only. Admins can allow the fields to appear in users Forum posts.    */
/*                                                                      */
/* All of the additional fields are editable by both user and admin     */
/* via all of the normal routes.                                        */
/*                                                                      */
/* Module created by Kenneth Arnold                                     */
/* Copyright (c) 2004 by Kenneth Arnold                                 */
/* released under GPL licence                                           */
/*                                                                      */
/* email:     arnoldkrg@hotmail.com                                     */
/* website:   http://www.ulsoft.scarbridge.co.uk                        */
/*                                                                      */
/************************************************************************/
if ( !defined('IN_PHPBB') )
{
        die("Hacking attempt");
        exit;
}

function check_image_type(&$type, &$error, &$error_msg)
{
        global $lang;

        switch( $type )
        {
                case 'jpeg':
                case 'pjpeg':
                case 'jpg':
                        return '.jpg';
                        break;
                case 'gif':
                        return '.gif';
                        break;
                case 'png':
                        return '.png';
                        break;
                default:
                        $error = true;
                        $error_msg = (!empty($error_msg)) ? $error_msg . '<br />' . $lang['Avatar_filetype'] : $lang['Avatar_filetype'];
                        break;
        }

        return false;
}

function user_avatar_delete($avatar_type, $avatar_file)
{
        global $board_config, $userdata;
   $avatar_file = basename($avatar_file);       

        if ( $avatar_type == USER_AVATAR_UPLOAD && !empty($avatar_file) )
        {
                if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $avatar_file)) )
                {
                        @unlink('./' . $board_config['avatar_path'] . '/' . $avatar_file);
                }
        }

        return ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;
}

function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename)
{
        global $board_config;
   $avatar_filename = str_replace(array('../', '..\\', './', '.\\'), '', $avatar_filename);
   if ($avatar_filename{0} == '/' || $avatar_filename{0} == "\\")
   {
      return '';
   }       
        if ( file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_filename)) && ($mode == 'editprofile') )
        {
                $return = ", user_avatar = '" . str_replace("\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
        }
        else
        {
                $return = '';
        }
        return $return;
}

function user_avatar_url($mode, &$error, &$error_msg, $avatar_filename)
{
   global $lang;
      
        if ( !preg_match('#^(http)|(ftp):\/\/#i', $avatar_filename) )
        {
                $avatar_filename = 'http://' . $avatar_filename;
        }

         if ( !preg_match("#^((ht|f)tp://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png))$)#is", $avatar_filename) )
        {
                $error = true;
                $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format'];
                return;
        }

        return ( $mode == 'editprofile' ) ? ", user_avatar = '" . str_replace("\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_REMOTE : '';

}

function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_type, &$error, &$error_msg, $avatar_filename, $avatar_realname, $avatar_filesize, $avatar_filetype)
{
        global $board_config, $db, $lang;

        $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';

        if ( $avatar_mode == 'remote' && preg_match('/^(http:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $avatar_filename, $url_ary) )
        {
                if ( empty($url_ary[4]) )
                {
                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Incomplete_URL'] : $lang['Incomplete_URL'];
                        return;
                }

                $base_get = '/' . $url_ary[4];
                $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80;

                if ( !($fsock = @fsockopen($url_ary[2], $port, $errno, $errstr)) )
                {
                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['No_connection_URL'] : $lang['No_connection_URL'];
                        return;
                }

                @fputs($fsock, "GET $base_get HTTP/1.1\r\n");
                @fputs($fsock, "HOST: " . $url_ary[2] . "\r\n");
                @fputs($fsock, "Connection: close\r\n\r\n");

                unset($avatar_data);
                while( !@feof($fsock) )
                {
                        $avatar_data .= @fread($fsock, $board_config['avatar_filesize']);
                }
                @fclose($fsock);

                if (!preg_match('#Content-Length\: ([0-9]+)[^ /][\s]+#i', $avatar_data, $file_data1) || !preg_match('#Content-Type\: image/[x\-]*([a-z]+)[\s]+#i', $avatar_data, $file_data2))
                {
                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['File_no_data'] : $lang['File_no_data'];
                        return;
                }

                $avatar_filesize = $file_data1[1];
                $avatar_filetype = $file_data2[1];

                if ( !$error && $avatar_filesize > 0 && $avatar_filesize < $board_config['avatar_filesize'] )
                {
                        $avatar_data = substr($avatar_data, strlen($avatar_data) - $avatar_filesize, $avatar_filesize);

                        $tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : './' . $board_config['avatar_path'] . '/tmp';
                        $tmp_filename = tempnam($tmp_path, uniqid(rand()) . '-');

                        $fptr = @fopen($tmp_filename, 'wb');
                        $bytes_written = @fwrite($fptr, $avatar_data, $avatar_filesize);
                        @fclose($fptr);

                        if ( $bytes_written != $avatar_filesize )
                        {
                                @unlink($tmp_filename);
                                message_die(GENERAL_ERROR, 'Could not write avatar file to local storage. Please contact the board administrator with this message', '', __LINE__, __FILE__);
                        }

                        list($width, $height) = @getimagesize($tmp_filename);
                }
                else
                {
                        $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
                }
        }
        else if ( ( file_exists(@phpbb_realpath($avatar_filename)) ) && preg_match('/\.(jpg|jpeg|gif|png)$/i', $avatar_realname) )
        {
                if ( $avatar_filesize <= $board_config['avatar_filesize'] && $avatar_filesize > 0 )
                {
                        preg_match('#image\/[x\-]*([a-z]+)#', $avatar_filetype, $avatar_filetype);
                        $avatar_filetype = $avatar_filetype[1];
                }
                else
                {
                        $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
                        return;
                }

                list($width, $height) = @getimagesize($avatar_filename);
        }

        if ( !($imgtype = check_image_type($avatar_filetype, $error, $error_msg)) )
        {
                return;
        }

   if ( $width > 0 && $height > 0 && $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
        {
                $new_filename = uniqid(rand()) . $imgtype;

                if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && !empty($current_avatar) )
                {
                        if ( file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $current_avatar)) )
                        {
                                @unlink('./' . $board_config['avatar_path'] . '/' . $current_avatar);
                        }
                }

                if( $avatar_mode == 'remote' )
                {
                        @copy($tmp_filename, './' . $board_config['avatar_path'] . "/$new_filename");
                        @unlink($tmp_filename);
                }
                else
                {
                        if ( @$ini_val('open_basedir') != '' )
                        {
                                if ( @phpversion() < '4.0.3' )
                                {
                                        message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file', '', __LINE__, __FILE__);
                                }

                                $move_file = 'move_uploaded_file';
                        }
                        else
                        {
                                $move_file = 'copy';
                        }
         if (!is_uploaded_file($avatar_filename))
         {
            message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
         }
                        $move_file($avatar_filename, './' . $board_config['avatar_path'] . "/$new_filename");
                }

                @chmod('./' . $board_config['avatar_path'] . "/$new_filename", 0777);

                $avatar_sql = ( $mode == 'editprofile' ) ? ", user_avatar = '$new_filename', user_avatar_type = " . USER_AVATAR_UPLOAD : "'$new_filename', " . USER_AVATAR_UPLOAD;
        }
        else
        {
                $l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);

                $error = true;
                $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
        }

        return $avatar_sql;
}

function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$custom1, &$custom2, &$custom3, &$custom4, &$custom5, &$custom6, &$custom7, &$custom8, &$custom9, &$custom10, &$custom11, &$custom12, &$custom13, &$custom14, &$custom15, &$custom16, &$custom17, &$custom18, &$custom19, &$custom20, &$custom21, &$custom22, &$custom23, &$custom24, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$user_show_custom1, &$user_show_custom2, &$user_show_custom3, &$user_show_custom4, &$user_show_custom5, &$user_show_custom6, &$user_show_custom7, &$user_show_custom8, &$user_show_custom9, &$user_show_custom10, &$user_show_custom11, &$user_show_custom12, &$user_show_custom13, &$user_show_custom14, &$user_show_custom15, &$user_show_custom16, &$user_show_custom17, &$user_show_custom18, &$user_show_custom19, &$user_show_custom20, &$user_show_custom21, &$user_show_custom22, &$user_show_custom23, &$user_show_custom24, &$notifypm, &$popup_pm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat, &$session_id)
{
        global $board_config, $db, $template, $lang, $images, $theme;
        global $phpbb_root_path, $phpEx;

        $dir = @opendir($board_config['avatar_gallery_path']);

        $avatar_images = array();
        while( $file = @readdir($dir) )
        {
                if( $file != '.' && $file != '..' && !is_file($board_config['avatar_gallery_path'] . '/' . $file) && !is_link($board_config['avatar_gallery_path'] . '/' . $file) )
                {
                        $sub_dir = @opendir($board_config['avatar_gallery_path'] . '/' . $file);

                        $avatar_row_count = 0;
                        $avatar_col_count = 0;
                        while( $sub_file = @readdir($sub_dir) )
                        {
                                if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $sub_file) )
                                {
                                        $avatar_images[$file][$avatar_row_count][$avatar_col_count] = $file . '/' . $sub_file;
                                        $avatar_name[$file][$avatar_row_count][$avatar_col_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $sub_file)));

                                        $avatar_col_count++;
                                        if( $avatar_col_count == 5 )
                                        {
                                                $avatar_row_count++;
                                                $avatar_col_count = 0;
                                        }
                                }
                        }
                }
        }

        @closedir($dir);

        @ksort($avatar_images);
        @reset($avatar_images);

        if( empty($category) )
        {
                list($category, ) = each($avatar_images);
        }
        @reset($avatar_images);

        $s_categories = '<select name="avatarcategory">';
        while( list($key) = each($avatar_images) )
        {
                $selected = ( $key == $category ) ? ' selected="selected"' : '';
                if( count($avatar_images[$key]) )
                {
                        $s_categories .= '<option value="' . $key . '"' . $selected . '>' . ucfirst($key) . '</option>';
                }
        }
        $s_categories .= '</select>';

        $s_colspan = 0;
        for($i = 0; $i < count($avatar_images[$category]); $i++)
        {
                $template->assign_block_vars("avatar_row", array());

                $s_colspan = max($s_colspan, count($avatar_images[$category][$i]));

                for($j = 0; $j < count($avatar_images[$category][$i]); $j++)
                {
                        $template->assign_block_vars('avatar_row.avatar_column', array(
                                "AVATAR_IMAGE" => $board_config['avatar_gallery_path'] . '/' . $avatar_images[$category][$i][$j],
                                "AVATAR_NAME" => $avatar_name[$category][$i][$j])
                        );

                        $template->assign_block_vars('avatar_row.avatar_option_column', array(
                                "S_OPTIONS_AVATAR" => $avatar_images[$category][$i][$j])
                        );
                }
        }

        $params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'custom1', 'custom2', 'custom3', 'custom4', 'custom5', 'custom6', 'custom7', 'custom8', 'custom9', 'custom10', 'custom11', 'custom12', 'custom13', 'custom14', 'custom15', 'custom16', 'custom17', 'custom18', 'custom19', 'custom20', 'custom21', 'custom22', 'custom23', 'custom24', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'user_show_custom1', 'user_show_custom2', 'user_show_custom3', 'user_show_custom4', 'user_show_custom5', 'user_show_custom6', 'user_show_custom7', 'user_show_custom8', 'user_show_custom9', 'user_show_custom10', 'user_show_custom11', 'user_show_custom12', 'user_show_custom13', 'user_show_custom14', 'user_show_custom15', 'user_show_custom16', 'user_show_custom17', 'user_show_custom18', 'user_show_custom19', 'user_show_custom20', 'user_show_custom21', 'user_show_custom22', 'user_show_custom23', 'user_show_custom24', 'notifypm', 'popup_pm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat');

        $s_hidden_vars = '<input type="hidden" name="sid" value="' . $session_id . '" /><input type="hidden" name="agreed" value="true" />';

        for($i = 0; $i < count($params); $i++)
        {
                $s_hidden_vars .= '<input type="hidden" name="' . $params[$i] . '" value="' . str_replace('"', '&quot;', $$params[$i]) . '" />';
        }

        $template->assign_vars(array(
                'L_AVATAR_GALLERY' => $lang['Avatar_gallery'],
                'L_SELECT_AVATAR' => $lang['Select_avatar'],
                'L_RETURN_PROFILE' => $lang['Return_profile'],
                'L_CATEGORY' => $lang['Select_category'],

                'S_CATEGORY_SELECT' => $s_categories,
                'S_COLSPAN' => $s_colspan,
                'S_PROFILE_ACTION' => append_sid("profile.$phpEx?mode=$mode"),
                'S_HIDDEN_FIELDS' => $s_hidden_vars)
        );

        return;
}
# $Log: usercp_avatar.php,v $
# Revision 1.1  2004/10/07 17:34:44  chatserv
# Initial CVS Addition
#

?>


My attempt at merging the two:-

Code:


My attempt at merging RN2.02 and the ApproveMembership code:-

<?php
/***************************************************************************
 *                             usercp_avatar.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : [ Only registered users can see links on this board! Get registered or login! ]
 *
 *   $Id: usercp_avatar.php,v 1.8.2.22 2005/10/30 15:17:14 acydburn Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 ***************************************************************************/
/*                                                                      */
/* Add_Fields Version 4.0                                               */
/*                                                                      */
/* Allows administrators to add up to 5 admin defined text fields to    */
/* the registration form. Admin can define the name, size and maxlength */
/* of each field and whether the field is activated or not.             */
/*                                                                      */
/* Allows administrators to add up to 4 admin defined select boxes to   */
/* the registration form. Admin can define the name, options and the    */
/* default option of each box and whether the box is activated or not.  */
/*                                                                      */
/* Admin can choose whether text fields are Required or Optional.       */
/* Admin can allow the member to turn off the fields for public         */
/* viewing. Admin can allow the fields to be shown in the Members List. */
/* Admin can choose whether each field is for public view or for admins */
/* only. Admins can allow the fields to appear in users Forum posts.    */
/*                                                                      */
/* All of the additional fields are editable by both user and admin     */
/* via all of the normal routes.                                        */
/*                                                                      */
/* Module created by Kenneth Arnold                                     */
/* Copyright (c) 2004 by Kenneth Arnold                                 */
/* released under GPL licence                                           */
/*                                                                      */
/* email:     arnoldkrg@hotmail.com                                     */
/* website:   http://www.ulsoft.scarbridge.co.uk                        */
/*                                                                      */
/************************************************************************/
if ( !defined('IN_PHPBB') )
{
        die("Hacking attempt");
        exit;
}

function check_image_type(&$type, &$error, &$error_msg)
{
        global $lang;

        switch( $type )
{
   case 'jpeg':
   case 'pjpeg':
   case 'image/pjpeg':
   case 'jpg':
      return '.jpg';
      break;
   case 'image/gif':
   case 'gif':
      return '.gif';
      break;
   case 'image/x-png':
   case 'png':
      return '.png';
      break;
   default:
      $error = true;
      $error_msg = (!empty($error_msg)) ? $error_msg . '<br />' . $lang['Avatar_filetype'] : $lang['Avatar_filetype'];
      break;
}

        return false;
}

function user_avatar_delete($avatar_type, $avatar_file)
{
        global $board_config, $userdata;
   $avatar_file = basename($avatar_file);

        if ( $avatar_type == USER_AVATAR_UPLOAD && $avatar_file != '' )
        {
                if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $avatar_file)) )
                {
                        @unlink('./' . $board_config['avatar_path'] . '/' . $avatar_file);
                }
        }

        return ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;
}

function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename, $avatar_category)
{
   global $board_config;

   $avatar_filename = phpbb_ltrim(basename($avatar_filename), "'");
   $avatar_category = phpbb_ltrim(basename($avatar_category), "'");

   if(!preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $avatar_filename))
   {
      return '';
   }

   if ($avatar_filename == "" || $avatar_category == "")
   {
      return '';
   }

   if ( file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_category . '/' . $avatar_filename)) && ($mode == 'editprofile') )
   {
      $return = ", user_avatar = '" . str_replace("\'", "''", $avatar_category . '/' . $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
   }
   else
   {
      $return = '';
   }
   return $return;
}

function user_avatar_url($mode, &$error, &$error_msg, $avatar_filename)
{
   global $lang;

        if ( !preg_match('#^(http)|(ftp):\/\/#i', $avatar_filename) )
        {
                $avatar_filename = 'http://' . $avatar_filename;
        }

         if ( !preg_match("#^((ht|f)tp://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png))$)#is", $avatar_filename) )
        {
                $error = true;
                $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format'];
                return;
        }

        return ( $mode == 'editprofile' ) ? ", user_avatar = '" . str_replace("\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_REMOTE : '';

}

function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_type, &$error, &$error_msg, $avatar_filename, $avatar_realname, $avatar_filesize, $avatar_filetype)
{
        global $board_config, $db, $lang;

        $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';

        $width = $height = 0;
        $type = '';
        if ( $avatar_mode == 'remote' && preg_match('/^(http:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $avatar_filename, $url_ary) )
        {
                if ( empty($url_ary[4]) )
                {
                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Incomplete_URL'] : $lang['Incomplete_URL'];
                        return;
                }

                $base_get = '/' . $url_ary[4];
                $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80;

                if ( !($fsock = @fsockopen($url_ary[2], $port, $errno, $errstr)) )
                {
                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['No_connection_URL'] : $lang['No_connection_URL'];
                        return;
                }

                @fputs($fsock, "GET $base_get HTTP/1.1\r\n");
                @fputs($fsock, "HOST: " . $url_ary[2] . "\r\n");
                @fputs($fsock, "Connection: close\r\n\r\n");

                unset($avatar_data);
                while( !@feof($fsock) )
                {
                        $avatar_data .= @fread($fsock, $board_config['avatar_filesize']);
                }
                @fclose($fsock);

                if (!preg_match('#Content-Length\: ([0-9]+)[^ /][\s]+#i', $avatar_data, $file_data1) || !preg_match('#Content-Type\: image/[x\-]*([a-z]+)[\s]+#i', $avatar_data, $file_data2))
                {
                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['File_no_data'] : $lang['File_no_data'];
                        return;
                }

                $avatar_filesize = $file_data1[1];
                $avatar_filetype = $file_data2[1];

                if ( !$error && $avatar_filesize > 0 && $avatar_filesize < $board_config['avatar_filesize'] )
                {
                        $avatar_data = substr($avatar_data, strlen($avatar_data) - $avatar_filesize, $avatar_filesize);

                        $tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : './' . $board_config['avatar_path'] . '/tmp';
                        $tmp_filename = tempnam($tmp_path, uniqid(rand()) . '-');

                        $fptr = @fopen($tmp_filename, 'wb');
                        $bytes_written = @fwrite($fptr, $avatar_data, $avatar_filesize);
                        @fclose($fptr);

                        if ( $bytes_written != $avatar_filesize )
                        {
                                @unlink($tmp_filename);
                                message_die(GENERAL_ERROR, 'Could not write avatar file to local storage. Please contact the board administrator with this message', '', __LINE__, __FILE__);
                        }

                        list($width, $height, $type) = @getimagesize($tmp_filename);
                }
                else
                {
                        $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
                }
        }
        else if ( ( file_exists(@phpbb_realpath($avatar_filename)) ) && preg_match('/\.(jpg|jpeg|gif|png)$/i', $avatar_realname) )
        {
                if ( $avatar_filesize <= $board_config['avatar_filesize'] && $avatar_filesize > 0 )
                {
                        preg_match('#image\/[x\-]*([a-z]+)#', $avatar_filetype, $avatar_filetype);
                        $avatar_filetype = $avatar_filetype[1];
                }
                else
                {
                        $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
                        return;
                }

                list($width, $height, $type) = @getimagesize($avatar_filename);
        }

        if ( !($imgtype = check_image_type($avatar_filetype, $error, $error_msg)) )
        {
                return;
        }

   switch ($type)
   {
      // GIF
      case 1:
         if ($imgtype != '.gif')
         {
            @unlink($tmp_filename);
            message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
         }
      break;

      // JPG, JPC, JP2, JPX, JB2
      case 2:
      case 9:
      case 10:
      case 11:
      case 12:
         if ($imgtype != '.jpg' && $imgtype != '.jpeg')
         {
            @unlink($tmp_filename);
            message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
         }
      break;

      // PNG
      case 3:
         if ($imgtype != '.png')
         {
            @unlink($tmp_filename);
            message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
         }
      break;

      default:
         @unlink($tmp_filename);
         message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
   }
   if ( $width > 0 && $height > 0 && $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
        {
                $new_filename = uniqid(rand()) . $imgtype;

                if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '' )
                {
                        user_avatar_delete($current_type, $current_avatar);
                }

                if( $avatar_mode == 'remote' )
                {
                        @copy($tmp_filename, './' . $board_config['avatar_path'] . "/$new_filename");
                        @unlink($tmp_filename);
                }
                else
                {
                        if ( @$ini_val('open_basedir') != '' )
                        {
                                if ( @phpversion() < '4.0.3' )
                                {
                                        message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file', '', __LINE__, __FILE__);
                                }

                                $move_file = 'move_uploaded_file';
                        }
                        else
                        {
                                $move_file = 'copy';
                        }
         if (!is_uploaded_file($avatar_filename))
         {
            message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
         }

                        $move_file($avatar_filename, './' . $board_config['avatar_path'] . "/$new_filename");
                }

                @chmod('./' . $board_config['avatar_path'] . "/$new_filename", 0777);

                $avatar_sql = ( $mode == 'editprofile' ) ? ", user_avatar = '$new_filename', user_avatar_type = " . USER_AVATAR_UPLOAD : "'$new_filename', " . USER_AVATAR_UPLOAD;
        }
        else
        {
                $l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);

                $error = true;
                $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
        }

        return $avatar_sql;
}

function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$custom1, &$custom2, &$custom3, &$custom4, &$custom5, &$custom6, &$custom7, &$custom8, &$custom9, &$custom10, &$custom11, &$custom12, &$custom13, &$custom14, &$custom15, &$custom16, &$custom17, &$custom18, &$custom19, &$custom20, &$custom21, &$custom22, &$custom23, &$custom24, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$user_show_custom1, &$user_show_custom2, &$user_show_custom3, &$user_show_custom4, &$user_show_custom5, &$user_show_custom6, &$user_show_custom7, &$user_show_custom8, &$user_show_custom9, &$user_show_custom10, &$user_show_custom11, &$user_show_custom12, &$user_show_custom13, &$user_show_custom14, &$user_show_custom15, &$user_show_custom16, &$user_show_custom17, &$user_show_custom18, &$user_show_custom19, &$user_show_custom20, &$user_show_custom21, &$user_show_custom22, &$user_show_custom23, &$user_show_custom24, &$notifypm, &$popup_pm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat, &$session_id)
{
        global $board_config, $db, $template, $lang, $images, $theme;
        global $phpbb_root_path, $phpEx;

        $dir = @opendir($board_config['avatar_gallery_path']);

        $avatar_images = array();
        while( $file = @readdir($dir) )
        {
                if( $file != '.' && $file != '..' && !is_file($board_config['avatar_gallery_path'] . '/' . $file) && !is_link($board_config['avatar_gallery_path'] . '/' . $file) )
                {
                        $sub_dir = @opendir($board_config['avatar_gallery_path'] . '/' . $file);

                        $avatar_row_count = 0;
                        $avatar_col_count = 0;
                        while( $sub_file = @readdir($sub_dir) )
                        {
                                if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $sub_file) )
                                {
                                        $avatar_images[$file][$avatar_row_count][$avatar_col_count] = $sub_file;
                                        $avatar_name[$file][$avatar_row_count][$avatar_col_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $sub_file)));

                                        $avatar_col_count++;
                                        if( $avatar_col_count == 5 )
                                        {
                                                $avatar_row_count++;
                                                $avatar_col_count = 0;
                                        }
                                }
                        }
                }
        }

        @closedir($dir);

        @ksort($avatar_images);
        @reset($avatar_images);

        if( empty($category) )
        {
                list($category, ) = each($avatar_images);
        }
        @reset($avatar_images);

        $s_categories = '<select name="avatarcategory">';
        while( list($key) = each($avatar_images) )
        {
                $selected = ( $key == $category ) ? ' selected="selected"' : '';
                if( count($avatar_images[$key]) )
                {
                        $s_categories .= '<option value="' . $key . '"' . $selected . '>' . ucfirst($key) . '</option>';
                }
        }
        $s_categories .= '</select>';

        $s_colspan = 0;
        for($i = 0; $i < count($avatar_images[$category]); $i++)
        {
                $template->assign_block_vars("avatar_row", array());

                $s_colspan = max($s_colspan, count($avatar_images[$category][$i]));

                for($j = 0; $j < count($avatar_images[$category][$i]); $j++)
                {
                        $template->assign_block_vars('avatar_row.avatar_column', array(
                                "AVATAR_IMAGE" => $board_config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_images[$category][$i][$j],
                                "AVATAR_NAME" => $avatar_name[$category][$i][$j])
                        );

                        $template->assign_block_vars('avatar_row.avatar_option_column', array(
                                "S_OPTIONS_AVATAR" => $avatar_images[$category][$i][$j])
                        );
                }
        }

        $params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'custom1', 'custom2', 'custom3', 'custom4', 'custom5', 'custom6', 'custom7', 'custom8', 'custom9', 'custom10', 'custom11', 'custom12', 'custom13', 'custom14', 'custom15', 'custom16', 'custom17', 'custom18', 'custom19', 'custom20', 'custom21', 'custom22', 'custom23', 'custom24', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'user_show_custom1', 'user_show_custom2', 'user_show_custom3', 'user_show_custom4', 'user_show_custom5', 'user_show_custom6', 'user_show_custom7', 'user_show_custom8', 'user_show_custom9', 'user_show_custom10', 'user_show_custom11', 'user_show_custom12', 'user_show_custom13', 'user_show_custom14', 'user_show_custom15', 'user_show_custom16', 'user_show_custom17', 'user_show_custom18', 'user_show_custom19', 'user_show_custom20', 'user_show_custom21', 'user_show_custom22', 'user_show_custom23', 'user_show_custom24', 'notifypm', 'popup_pm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat');

        $s_hidden_vars = '<input type="hidden" name="sid" value="' . $session_id . '" /><input type="hidden" name="avatarcatname" value="' . $category . '" />';

        for($i = 0; $i < count($params); $i++)
        {
                $s_hidden_vars .= '<input type="hidden" name="' . $params[$i] . '" value="' . str_replace('"', '&quot;', $$params[$i]) . '" />';
        }

        $template->assign_vars(array(
                'L_AVATAR_GALLERY' => $lang['Avatar_gallery'],
                'L_SELECT_AVATAR' => $lang['Select_avatar'],
                'L_RETURN_PROFILE' => $lang['Return_profile'],
                'L_CATEGORY' => $lang['Select_category'],

                'S_CATEGORY_SELECT' => $s_categories,
                'S_COLSPAN' => $s_colspan,
                'S_PROFILE_ACTION' => append_sid("profile.$phpEx?mode=$mode"),
                'S_HIDDEN_FIELDS' => $s_hidden_vars)
        );

        return;
}

?>



On trying to track it down I gather that it doesn't like the additional fields added (I think the custom ones). But I'm not sure and not an expert - I'm trying to learn tho!!! I'd really appreciate any help that can be offered or some pointers... I have appreciated the help and guidance here in a really good community and hope to stay if you don't kick me out for such a long post....

On a side note I'm keen to take a look at YA-CNB as I know it has a lot of the same features as ApproveMembership. The reason I haven't switched is that I'm unsure whether it has the easy approve/dissalow/followup email templates, and I was waiting for the snail paced update. I'm sure it will be worth it in the end. But for now, I'll stay with fixing this!!!!

Regards

Duncan
Glasgow, Scotland
 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Tue Jan 31, 2006 3:55 pm Reply with quote

Duncan, try this (but back up the mentioned script FIRST so you can put it back if needed!):

Overwrite the modules/Your_Account/index.php with the 7.6 version you had previously from your working 7.6 instance. Does it work then?

The only thing that changed, that I know of, is the addition of showing the NSN Groups a user is tied to when they click on Your Account.

If the above works, then using a good compare tool, such as the new WinMerge (at SourceForge and free) or Beyond Compare 2 (my favorite) and try to re-integrate NSN Groups changes into YOUR working copy of AMM and 7.6

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
Duncan







PostPosted: Tue Jan 31, 2006 4:45 pm Reply with quote

Apologies for replying in the quote in red.....

montego wrote:
Duncan, try this (but back up the mentioned script FIRST so you can put it back if needed!):

Overwrite the modules/Your_Account/index.php with the 7.6 version you had previously from your working 7.6 instance. Does it work then? No Sad I'm in danger of insulting your intelligence here, but Was it definately the index page? The error was coming up in the includes folder? I assume the function that is causing this may be in the index then?

The only thing that changed, that I know of, is the addition of showing the NSN Groups a user is tied to when they click on Your Account.

If the above works, then using a good compare tool, such as the new WinMerge (at SourceForge and free) or Beyond Compare 2 (my favorite) and try to re-integrate NSN Groups changes into YOUR working copy of AMM and 7.6. I use beyond compare2 already Smile and I agree it is good - but i need a faster processor for those big files!.
 
Duncan







PostPosted: Tue Jan 31, 2006 5:01 pm Reply with quote

It works when I replace the file ../includes/usercp_avatar.php
with the rn1.5 version i had running on my site that was in my backup archive (which on initial inspection - looks like I did not edit with the approvemembership mods - Ooops) - I'm going to compare the files.... But here it is just in case you are quicker!

I haven't a clue what this all means!! My brain is scrambled mush!!!!


Code:


<?php
/***************************************************************************
 *                             usercp_avatar.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : [ Only registered users can see links on this board! Get registered or login! ]
 *
 *   $Id: usercp_avatar.php,v 1.8.2.22 2005/10/30 15:17:14 acydburn Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 ***************************************************************************/
if ( !defined('IN_PHPBB') )
{
        die("Hacking attempt");
        exit;
}

function check_image_type(&$type, &$error, &$error_msg)
{
        global $lang;

        switch( $type )
{
   case 'jpeg':
   case 'pjpeg':
   case 'image/pjpeg':
   case 'jpg':
      return '.jpg';
      break;
   case 'image/gif':
   case 'gif':
      return '.gif';
      break;
   case 'image/x-png':
   case 'png':
      return '.png';
      break;
   default:
      $error = true;
      $error_msg = (!empty($error_msg)) ? $error_msg . '<br />' . $lang['Avatar_filetype'] : $lang['Avatar_filetype'];
      break;
}

        return false;
}

function user_avatar_delete($avatar_type, $avatar_file)
{
        global $board_config, $userdata;
   $avatar_file = basename($avatar_file);

        if ( $avatar_type == USER_AVATAR_UPLOAD && $avatar_file != '' )
        {
                if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $avatar_file)) )
                {
                        @unlink('./' . $board_config['avatar_path'] . '/' . $avatar_file);
                }
        }

        return ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;
}

function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename, $avatar_category)
{
   global $board_config;

   $avatar_filename = phpbb_ltrim(basename($avatar_filename), "'");
   $avatar_category = phpbb_ltrim(basename($avatar_category), "'");

   if(!preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $avatar_filename))
   {
      return '';
   }

   if ($avatar_filename == "" || $avatar_category == "")
   {
      return '';
   }

   if ( file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_category . '/' . $avatar_filename)) && ($mode == 'editprofile') )
   {
      $return = ", user_avatar = '" . str_replace("\'", "''", $avatar_category . '/' . $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
   }
   else
   {
      $return = '';
   }
   return $return;
}

function user_avatar_url($mode, &$error, &$error_msg, $avatar_filename)
{
   global $lang;

        if ( !preg_match('#^(http)|(ftp):\/\/#i', $avatar_filename) )
        {
                $avatar_filename = 'http://' . $avatar_filename;
        }

         if ( !preg_match("#^((ht|f)tp://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png))$)#is", $avatar_filename) )
        {
                $error = true;
                $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format'];
                return;
        }

        return ( $mode == 'editprofile' ) ? ", user_avatar = '" . str_replace("\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_REMOTE : '';

}

function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_type, &$error, &$error_msg, $avatar_filename, $avatar_realname, $avatar_filesize, $avatar_filetype)
{
        global $board_config, $db, $lang;

        $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';

        $width = $height = 0;
        $type = '';
        if ( $avatar_mode == 'remote' && preg_match('/^(http:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $avatar_filename, $url_ary) )
        {
                if ( empty($url_ary[4]) )
                {
                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Incomplete_URL'] : $lang['Incomplete_URL'];
                        return;
                }

                $base_get = '/' . $url_ary[4];
                $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80;

                if ( !($fsock = @fsockopen($url_ary[2], $port, $errno, $errstr)) )
                {
                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['No_connection_URL'] : $lang['No_connection_URL'];
                        return;
                }

                @fputs($fsock, "GET $base_get HTTP/1.1\r\n");
                @fputs($fsock, "HOST: " . $url_ary[2] . "\r\n");
                @fputs($fsock, "Connection: close\r\n\r\n");

                unset($avatar_data);
                while( !@feof($fsock) )
                {
                        $avatar_data .= @fread($fsock, $board_config['avatar_filesize']);
                }
                @fclose($fsock);

                if (!preg_match('#Content-Length\: ([0-9]+)[^ /][\s]+#i', $avatar_data, $file_data1) || !preg_match('#Content-Type\: image/[x\-]*([a-z]+)[\s]+#i', $avatar_data, $file_data2))
                {
                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['File_no_data'] : $lang['File_no_data'];
                        return;
                }

                $avatar_filesize = $file_data1[1];
                $avatar_filetype = $file_data2[1];

                if ( !$error && $avatar_filesize > 0 && $avatar_filesize < $board_config['avatar_filesize'] )
                {
                        $avatar_data = substr($avatar_data, strlen($avatar_data) - $avatar_filesize, $avatar_filesize);

                        $tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : './' . $board_config['avatar_path'] . '/tmp';
                        $tmp_filename = tempnam($tmp_path, uniqid(rand()) . '-');

                        $fptr = @fopen($tmp_filename, 'wb');
                        $bytes_written = @fwrite($fptr, $avatar_data, $avatar_filesize);
                        @fclose($fptr);

                        if ( $bytes_written != $avatar_filesize )
                        {
                                @unlink($tmp_filename);
                                message_die(GENERAL_ERROR, 'Could not write avatar file to local storage. Please contact the board administrator with this message', '', __LINE__, __FILE__);
                        }

                        list($width, $height, $type) = @getimagesize($tmp_filename);
                }
                else
                {
                        $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
                }
        }
        else if ( ( file_exists(@phpbb_realpath($avatar_filename)) ) && preg_match('/\.(jpg|jpeg|gif|png)$/i', $avatar_realname) )
        {
                if ( $avatar_filesize <= $board_config['avatar_filesize'] && $avatar_filesize > 0 )
                {
                        preg_match('#image\/[x\-]*([a-z]+)#', $avatar_filetype, $avatar_filetype);
                        $avatar_filetype = $avatar_filetype[1];
                }
                else
                {
                        $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

                        $error = true;
                        $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
                        return;
                }

                list($width, $height, $type) = @getimagesize($avatar_filename);
        }

        if ( !($imgtype = check_image_type($avatar_filetype, $error, $error_msg)) )
        {
                return;
        }

   switch ($type)
   {
      // GIF
      case 1:
         if ($imgtype != '.gif')
         {
            @unlink($tmp_filename);
            message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
         }
      break;

      // JPG, JPC, JP2, JPX, JB2
      case 2:
      case 9:
      case 10:
      case 11:
      case 12:
         if ($imgtype != '.jpg' && $imgtype != '.jpeg')
         {
            @unlink($tmp_filename);
            message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
         }
      break;

      // PNG
      case 3:
         if ($imgtype != '.png')
         {
            @unlink($tmp_filename);
            message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
         }
      break;

      default:
         @unlink($tmp_filename);
         message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
   }
   if ( $width > 0 && $height > 0 && $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
        {
                $new_filename = uniqid(rand()) . $imgtype;

                if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '' )
                {
                        user_avatar_delete($current_type, $current_avatar);
                }

                if( $avatar_mode == 'remote' )
                {
                        @copy($tmp_filename, './' . $board_config['avatar_path'] . "/$new_filename");
                        @unlink($tmp_filename);
                }
                else
                {
                        if ( @$ini_val('open_basedir') != '' )
                        {
                                if ( @phpversion() < '4.0.3' )
                                {
                                        message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file', '', __LINE__, __FILE__);
                                }

                                $move_file = 'move_uploaded_file';
                        }
                        else
                        {
                                $move_file = 'copy';
                        }
         if (!is_uploaded_file($avatar_filename))
         {
            message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
         }

                        $move_file($avatar_filename, './' . $board_config['avatar_path'] . "/$new_filename");
                }

                @chmod('./' . $board_config['avatar_path'] . "/$new_filename", 0777);

                $avatar_sql = ( $mode == 'editprofile' ) ? ", user_avatar = '$new_filename', user_avatar_type = " . USER_AVATAR_UPLOAD : "'$new_filename', " . USER_AVATAR_UPLOAD;
        }
        else
        {
                $l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);

                $error = true;
                $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
        }

        return $avatar_sql;
}

function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popup_pm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat, &$session_id)
{
        global $board_config, $db, $template, $lang, $images, $theme;
        global $phpbb_root_path, $phpEx;

        $dir = @opendir($board_config['avatar_gallery_path']);

        $avatar_images = array();
        while( $file = @readdir($dir) )
        {
                if( $file != '.' && $file != '..' && !is_file($board_config['avatar_gallery_path'] . '/' . $file) && !is_link($board_config['avatar_gallery_path'] . '/' . $file) )
                {
                        $sub_dir = @opendir($board_config['avatar_gallery_path'] . '/' . $file);

                        $avatar_row_count = 0;
                        $avatar_col_count = 0;
                        while( $sub_file = @readdir($sub_dir) )
                        {
                                if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $sub_file) )
                                {
                                        $avatar_images[$file][$avatar_row_count][$avatar_col_count] = $sub_file;
                                        $avatar_name[$file][$avatar_row_count][$avatar_col_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $sub_file)));

                                        $avatar_col_count++;
                                        if( $avatar_col_count == 5 )
                                        {
                                                $avatar_row_count++;
                                                $avatar_col_count = 0;
                                        }
                                }
                        }
                }
        }

        @closedir($dir);

        @ksort($avatar_images);
        @reset($avatar_images);

        if( empty($category) )
        {
                list($category, ) = each($avatar_images);
        }
        @reset($avatar_images);

        $s_categories = '<select name="avatarcategory">';
        while( list($key) = each($avatar_images) )
        {
                $selected = ( $key == $category ) ? ' selected="selected"' : '';
                if( count($avatar_images[$key]) )
                {
                        $s_categories .= '<option value="' . $key . '"' . $selected . '>' . ucfirst($key) . '</option>';
                }
        }
        $s_categories .= '</select>';

        $s_colspan = 0;
        for($i = 0; $i < count($avatar_images[$category]); $i++)
        {
                $template->assign_block_vars("avatar_row", array());

                $s_colspan = max($s_colspan, count($avatar_images[$category][$i]));

                for($j = 0; $j < count($avatar_images[$category][$i]); $j++)
                {
                        $template->assign_block_vars('avatar_row.avatar_column', array(
                                "AVATAR_IMAGE" => $board_config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_images[$category][$i][$j],
                                "AVATAR_NAME" => $avatar_name[$category][$i][$j])
                        );

                        $template->assign_block_vars('avatar_row.avatar_option_column', array(
                                "S_OPTIONS_AVATAR" => $avatar_images[$category][$i][$j])
                        );
                }
        }

        $params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popup_pm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat');

        $s_hidden_vars = '<input type="hidden" name="sid" value="' . $session_id . '" /><input type="hidden" name="avatarcatname" value="' . $category . '" />';

        for($i = 0; $i < count($params); $i++)
        {
                $s_hidden_vars .= '<input type="hidden" name="' . $params[$i] . '" value="' . str_replace('"', '&quot;', $$params[$i]) . '" />';
        }

        $template->assign_vars(array(
                'L_AVATAR_GALLERY' => $lang['Avatar_gallery'],
                'L_SELECT_AVATAR' => $lang['Select_avatar'],
                'L_RETURN_PROFILE' => $lang['Return_profile'],
                'L_CATEGORY' => $lang['Select_category'],

                'S_CATEGORY_SELECT' => $s_categories,
                'S_COLSPAN' => $s_colspan,
                'S_PROFILE_ACTION' => append_sid("profile.$phpEx?mode=$mode"),
                'S_HIDDEN_FIELDS' => $s_hidden_vars)
        );

        return;
}

?>


The only differences in this file that gets it working are the ommision of the custom fields added by approve membership in TWO separate lines.

Code:


WORKING-
function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popup_pm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat, &$session_id)


NOT WORKING-
function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$custom1, &$custom2, &$custom3, &$custom4, &$custom5, &$custom6, &$custom7, &$custom8, &$custom9, &$custom10, &$custom11, &$custom12, &$custom13, &$custom14, &$custom15, &$custom16, &$custom17, &$custom18, &$custom19, &$custom20, &$custom21, &$custom22, &$custom23, &$custom24, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$user_show_custom1, &$user_show_custom2, &$user_show_custom3, &$user_show_custom4, &$user_show_custom5, &$user_show_custom6, &$user_show_custom7, &$user_show_custom8, &$user_show_custom9, &$user_show_custom10, &$user_show_custom11, &$user_show_custom12, &$user_show_custom13, &$user_show_custom14, &$user_show_custom15, &$user_show_custom16, &$user_show_custom17, &$user_show_custom18, &$user_show_custom19, &$user_show_custom20, &$user_show_custom21, &$user_show_custom22, &$user_show_custom23, &$user_show_custom24, &$notifypm, &$popup_pm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat, &$session_id)



     WORKING-
   $params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popup_pm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat');


NOT WORKING-
        $params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'custom1', 'custom2', 'custom3', 'custom4', 'custom5', 'custom6', 'custom7', 'custom8', 'custom9', 'custom10', 'custom11', 'custom12', 'custom13', 'custom14', 'custom15', 'custom16', 'custom17', 'custom18', 'custom19', 'custom20', 'custom21', 'custom22', 'custom23', 'custom24', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'user_show_custom1', 'user_show_custom2', 'user_show_custom3', 'user_show_custom4', 'user_show_custom5', 'user_show_custom6', 'user_show_custom7', 'user_show_custom8', 'user_show_custom9', 'user_show_custom10', 'user_show_custom11', 'user_show_custom12', 'user_show_custom13', 'user_show_custom14', 'user_show_custom15', 'user_show_custom16', 'user_show_custom17', 'user_show_custom18', 'user_show_custom19', 'user_show_custom20', 'user_show_custom21', 'user_show_custom22', 'user_show_custom23', 'user_show_custom24', 'notifypm', 'popup_pm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat');


I don't know if this may be relevant but there are a few other mods i have installed and they are running successfully as before, including Gallery2.

Thanks

Duncan
Glasgow, Scotland
 
Duncan







PostPosted: Wed Feb 01, 2006 3:25 am Reply with quote

Anyone got any ideas why the added 'custom' entries for Approve membership cause the error stated at the start of the thread - Warning: Missing argument for display_avatar_gallery() in /home/....../public_html/includes/usercp_avatar.php on line 338

If I leave this file un-edited which issues will it cause?

Could it be another file causing this error?

Thanks

Duncan
Glasgow, Scotland
 
montego







PostPosted: Wed Feb 01, 2006 6:25 am Reply with quote

Duncan wrote:
No Sad I'm in danger of insulting your intelligence here, but Was it definately the index page? The error was coming up in the includes folder? I assume the function that is causing this may be in the index then?


Duncan, I was picking up on what you said here "After upgrading to RNuke1.5 no problem with me integrating Approvemembership in, all working fine. The upgrade to 2.02 went ok to, but there seems to be a problem with avatars in the forum profile once I have tried to integrate the Approve membership into it. There seem to have been a few changes in the 2.02 Your_Account module"

Also, I have used Approved Membership module and I could not remember having to modify the user_avatar script, but that was almost a year ago. I cannot be expected to remember what I ate for lunch yesterday anymore...

I'll take a closer look at this. By the way, please be patient here because most of us have day jobs and family to attend to, so some responses may be a bit delayed especially if it requires research. Thanks.
 
montego







PostPosted: Wed Feb 01, 2006 7:12 am Reply with quote

Duncan, there must be a mismatch in the definition of the display_avatar_gallery function (with the number of parameters) you posted above and what is calling it. You need to find out what is calling this function and ensure that you made the appropriate modifications to the function call that is asked of you to make within the module installation instructions.

Either the instructions are in error or you missed an edit somewhere.
 
Duncan







PostPosted: Wed Feb 01, 2006 7:32 am Reply with quote

I'll check throught the whole edits again for approve membership.

I didn't mean to come across as impatient - just trying to get the site back up again. I feel bad/annoyed at myself that I stuffed it up and a few people are grumbling the site is down. I apolgise if I came across as impatient. I really do appreciate the time and expertise spent helping out. I realise that most people have full time jobs and families as I do too!

It's my day off today - so i'll re check my edits. Also, I posted on the Approve Membership site, so maybe they will have some advice for me too - that I will pass on.

My mistake again - "After upgrading to RNuke1.5 no problem with me integrating Approvemembership in, all working fine. " - This was only because I forgot to edit the file ../includes/usercp_avatar.php as suggested by Approve Membership. Once the edits are made as suggested by approvemembership it throws up the errors. The RN2.02 file version of this file is exactly the same as the 1.5 file - only .

Cheers

Duncan
 
Duncan







PostPosted: Wed Feb 01, 2006 8:06 am Reply with quote

ArnoldKrg led me to the solution in [ Only registered users can see links on this board! Get registered or login! ] . I'd forgotten to add one line to includes/usercp_register.php ! now it all works swimmingly!!!

Thanks again. It pays to check my own edited files - just I thought I had checked and couldnt see the wood for the trees! Thanks - especially Montego for the help and sorry to have wasted your time.

Duncan
Glasgow, Scotland
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's RavenNuke(tm) v2.00.00 - v2.02.00 Distro

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 ©