static function userAvatar(&$row, $option, $submitvalue)
    {
        global $_CB_framework, $_REQUEST, $ueConfig, $_FILES;
        outputCbTemplate(1);
        $title = cbSetTitlePath($row, _UE_UPDATEAVATAR, _UE_EDIT_OTHER_USER_TITLE);
        ?>
<!-- TAB -->
<div class="componentheading"><?php 
        echo $title;
        ?>
</div><br />
<?php 
        if ($ueConfig['allowAvatarUpload']) {
            echo "<div class='contentheading'>" . _UE_UPLOAD_SUBMIT . "</div>";
            echo sprintf(_UE_UPLOAD_DIMENSIONS_AVATAR, $ueConfig['avatarWidth'], $ueConfig['avatarHeight'], $ueConfig['avatarSize']);
            echo "\n<form action='" . cbSef("index.php?option=com_comprofiler&amp;task=userAvatar" . getCBprofileItemid(true)) . "' method='post' name='adminForm' enctype='multipart/form-data'>";
            echo "\n\t<input type='hidden' name='do' value='validate' />";
            if ($_CB_framework->myId() != $row->id) {
                echo "\n\t<input type='hidden' name='uid' value='" . $row->id . "' />";
            }
            echo "\n\t<table width='100%' border='0' cellpadding='4' cellspacing='2'>";
            echo "\n\t\t<tr align='center' valign='middle'>\n\t\t\t<td align='center' valign='top'>";
            //echo " <input type='hidden' name='MAX_FILE_SIZE' value='".$maxAllowed."' />";
            echo _UE_UPLOAD_SELECT_FILE . " <input type='file' name='avatar' value='' />";
            echo " <input type='submit' class='button' value='" . _UE_UPLOAD_UPLOAD . "' />";
            echo "</td>\n\t\t</tr>";
            echo "\n\t\t<tr align='center' valign='middle'>\n\t\t\t<td align='center' valign='top'>";
            echo $ueConfig['reg_enable_toc'] ? sprintf(_UE_AVATAR_UPLOAD_DISCLAIMER_TERMS, "<a href='" . cbSef(htmlspecialchars($ueConfig['reg_toc_url'])) . "' target='_BLANK'> " . _UE_AVATAR_TOC_LINK . "</a>") : _UE_AVATAR_UPLOAD_DISCLAIMER;
            echo "</td>\n\t\t</tr>";
            echo "</table><br/><br/>";
            echo "\n";
            echo cbGetSpoofInputTag('userAvatar');
            echo "</form>";
        }
        if ($ueConfig['allowAvatarGallery']) {
            echo "\n<div class='contentheading'>" . _UE_UPLOAD_GALLERY . "</div>";
            echo "\n<form action='" . cbSef("index.php?option=com_comprofiler&amp;task=userAvatar" . getCBprofileItemid(true)) . "' method='post' name='adminForm'>";
            echo "\n\t<input type='hidden' name='do' value='fromgallery' />";
            if ($_CB_framework->myId() != $row->id) {
                echo "\n\t<input type='hidden' name='uid' value='" . $row->id . "' />";
            }
            echo "\n\t<table width='100%' border='0' cellpadding='4' cellspacing='2'>";
            echo "\n\t\t<tr align='center' valign='middle'>";
            echo '<td colspan="5">&nbsp;</td></tr>';
            echo "\n\t\t<tr align='center' valign='middle'>";
            $live_site = $_CB_framework->getCfg('live_site');
            $avatar_gallery_path = $_CB_framework->getCfg('absolute_path') . '/images/comprofiler/gallery';
            $avatar_images = display_avatar_gallery($avatar_gallery_path);
            for ($i = 0; $i < count($avatar_images); $i++) {
                $j = $i + 1;
                echo "\n\t\t\t<td>";
                $avatar_name = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\\..*$/', '\\1', $avatar_images[$i])));
                echo '<img src="' . $live_site . '/images/comprofiler/gallery/' . $avatar_images[$i] . '" alt="' . $avatar_name . '" title="' . $avatar_name . '" />';
                echo '<input type="radio" name="newavatar" value="' . $avatar_images[$i] . '" />';
                echo '</td>';
                if (function_exists('fmod')) {
                    if (!fmod($j, 5)) {
                        echo "</tr>\n\t\t<tr align=\"center\" valign=\"middle\">";
                    }
                } else {
                    if (!fmodReplace($j, 5)) {
                        echo "</tr>\n\t\t<tr align=\"center\" valign=\"middle\">";
                    }
                }
            }
            echo "\n\t\t</tr>\n\t\t";
            echo '<tr><td colspan="5" align="center"><input class="button"  type="submit" value="' . _UE_UPLOAD_CHOOSE . '" /> ';
            echo '<input type="button" class="button" name="btncancel" value="' . _UE_CANCEL . '" onclick="window.location=\'' . cbSef("index.php?option=" . htmlspecialchars(cbGetParam($_REQUEST, 'option')) . ($row->id == $_CB_framework->myId() ? '' : '&amp;user='******'\';" />';
            echo '</td></tr>';
            echo "\n\t</table>";
            echo "\n";
            echo cbGetSpoofInputTag('userAvatar');
            echo "</form>\n";
        }
    }
 static function userEdit($user, $option, $submitvalue, $regErrorMSG = null)
 {
     global $_CB_framework, $ueConfig, $_REQUEST, $_PLUGINS;
     $results = $_PLUGINS->trigger('onBeforeUserProfileEditDisplay', array(&$user, 1));
     if ($_PLUGINS->is_errors()) {
         echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n";
         exit;
     }
     if ($regErrorMSG) {
         $_CB_framework->enqueueMessage($regErrorMSG, 'error');
     }
     if ($user->id != $_CB_framework->myId()) {
         $_CB_framework->enqueueMessage(sprintf(CBTxt::T('UE_WARNING_EDIT_OTHER_USER_PROFILE', 'WARNING: This is not your profile. As a moderator, you are editing the profile of user: %s.'), getNameFormat($user->name, $user->username, $ueConfig['name_format'])));
     }
     $output = 'htmledit';
     $formatting = isset($ueConfig['use_divs']) && !$ueConfig['use_divs'] ? 'table' : 'divs';
     $layout = isset($ueConfig['profile_edit_layout']) ? $ueConfig['profile_edit_layout'] : 'tabbed';
     $tabbed = in_array($layout, array('tabbed', 'stepped')) ? true : false;
     $cbTemplate = HTML_comprofiler::_cbTemplateLoad();
     outputCbTemplate(1);
     initToolTip(1);
     $title = cbSetTitlePath($user, CBTxt::T('UE_EDIT_TITLE', 'Edit Your Details'), CBTxt::T('UE_EDIT_OTHER_USER_TITLE', 'Edit %s\'s Details'));
     $tabs = new cbTabs(0, 1, null, $tabbed ? true : false);
     $tabcontent = $tabs->getEditTabs($user, null, $output, $formatting, 'edit', $tabbed ? true : false);
     $topIcons = null;
     $bottomIcons = null;
     if (isset($ueConfig['profile_edit_show_icons_explain']) && $ueConfig['profile_edit_show_icons_explain'] > 0) {
         $icons = getFieldIcons(1, true, true, '', '', true);
         if (in_array($ueConfig['profile_edit_show_icons_explain'], array(1, 3))) {
             $topIcons = $icons;
         }
         if (in_array($ueConfig['profile_edit_show_icons_explain'], array(2, 3))) {
             $bottomIcons = $icons;
         }
     }
     $js = "\$( '#cbbtncancel' ).click( function() {" . "window.location = '" . addslashes($_CB_framework->userProfileUrl($user->id, false, null, 'html', 0, array('reason' => 'canceledit'))) . "';" . "});";
     $_CB_framework->outputCbJQuery($js);
     cbValidator::loadValidation();
     $pageClass = $_CB_framework->getMenuPageClass();
     $return = '<div class="cbEditProfile ' . ($tabbed ? 'cbEditProfileTabbed' : 'cbEditProfileFlat') . ' cb_template cb_template_' . selectTemplate('dir') . ($pageClass ? ' ' . htmlspecialchars($pageClass) : null) . '">';
     if (is_array($results)) {
         $return .= implode('', $results);
     }
     $return .= ($title ? '<div class="page-header"><h3>' . $title . '</h3></div>' : null) . '<form action="' . $_CB_framework->viewUrl('saveuseredit') . '" method="post" id="cbcheckedadminForm" name="adminForm" enctype="multipart/form-data" class="cb_form form-auto cbValidation">' . '<input type="hidden" name="id" value="' . (int) $user->id . '" />' . cbGetSpoofInputTag('userEdit') . $_PLUGINS->callTemplate($cbTemplate, 'Profile', 'drawEditProfile', array(&$user, $tabcontent, $submitvalue, CBTxt::T('UE_CANCEL', 'Cancel'), $bottomIcons, $topIcons), $output) . '</form>' . '</div>' . cbPoweredBy();
     echo $return;
     $_PLUGINS->trigger('onAfterUserProfileEditDisplay', array($user, $tabcontent));
     $_CB_framework->setMenuMeta();
 }