// Default pages // include "includes/page_header.php"; make_jumpbox('viewforum.' . $phpEx); if ($mode == 'editprofile') { if ($user_id != $userdata['user_id']) { $error = TRUE; $error_msg = $lang['Wrong_Profile']; } } if (isset($HTTP_POST_VARS['avatargallery']) && !$error) { include "includes/usercp_avatar.php"; $avatar_category = !empty($HTTP_POST_VARS['avatarcategory']) ? $HTTP_POST_VARS['avatarcategory'] : ''; $template->set_filenames(array('body' => 'profile_avatar_gallery.tpl')); $allowviewonline = !$allowviewonline; display_avatar_gallery($mode, $avatar_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, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat, $userdata['session_id']); } else { include "includes/functions_selects.php"; if (!isset($coppa)) { $coppa = FALSE; } if (!isset($user_template)) { $selected_template = $board_config['system_template']; } $avatar_img = ''; if ($user_avatar_type) { switch ($user_avatar_type) { case USER_AVATAR_UPLOAD: $avatar_img = $board_config['allow_avatar_upload'] ? '<img src="' . $board_config['avatar_path'] . '/' . $user_avatar . '" alt="" />' : ''; break; case USER_AVATAR_REMOTE:
if ($user_id != $user->data['user_id']) { $error = true; $error_msg = $lang['Wrong_Profile']; } } if (isset($_POST['avatargallery']) && !$error) { include IP_ROOT_PATH . 'includes/usercp_avatar.' . PHP_EXT; $avatar_category = request_post_var('avatarcategory', ''); $template_to_parse = 'profile_avatar_gallery.tpl'; $allowviewonline = !$allowviewonline; // Replaced: $aim, $facebook, $flickr, $googleplus, $icq, $jabber, $linkedin, $msn, $skype, $twitter, $yim, $youtube, $user_sn_im_array = get_user_sn_im_array(); foreach ($user_sn_im_array as $k => $v) { $this_user_im[$v['form']] = ${$v}['form']; } display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $email_confirm, $coppa, $username, $new_password, $cur_password, $password_confirm, $this_user_im, $website, $location, $user_flag, $user_first_name, $user_last_name, $occupation, $interests, $phone, $selfdes, $signature, $viewemail, $notifypm, $popup_pm, $notifyreply, $attachsig, $setbm, $allowhtml, $allowbbcode, $allowsmilies, $showavatars, $showsignatures, $allowswearywords, $allowmassemail, $allowpmin, $allowviewonline, $user_style, $user_lang, $user_timezone, $time_mode, $dst_time_lag, $user_dateformat, $profile_view_popup, $user->data['session_id'], $birthday, $gender, $upi2db_which_system, $upi2db_new_word, $upi2db_edit_word, $upi2db_unread_color); } elseif (isset($_POST['avatargenerator']) && !$error) { if (!defined('CTRACKER_DISABLE_OUTPUT')) { define('CTRACKER_DISABLE_OUTPUT', true); } include IP_ROOT_PATH . 'includes/usercp_avatar.' . PHP_EXT; $avatar_filename = request_post_var('avatar_filename', ''); $avatar_filename = !empty($avatar_filename) ? $avatar_filename : POSTED_IMAGES_THUMBS_PATH . uniqid(rand()) . '.gif'; //$avatar_filename = (!empty($avatar_filename) ? $avatar_filename : $config['avatar_path'] . '/' . uniqid(rand()) . '.gif'); if (file_exists(@phpbb_realpath('./' . $avatar_filename))) { @unlink('./' . $avatar_filename); } $avatar_image = request_post_var('avatarimage', ''); $avatar_text = request_post_var('avatartext', ''); $avatar_image = !empty($avatar_image) ? $avatar_image : 'Random'; $avatar_text = !empty($avatar_text) ? $avatar_text : $username;
/** * * * @param moscomprofilerFields $field * @param moscomprofilerUser $user * @param string $reason 'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'list' for user-lists * @param boolean $displayFieldIcons * @return string HTML: <tag type="$type" value="$value" xxxx="xxx" yy="y" /> */ function _htmlEditForm(&$field, &$user, $reason, $displayFieldIcons = true) { global $_CB_framework, $_CB_database, $ueConfig; if ($field->name == 'avatar' && !($ueConfig['allowAvatarUpload'] || $ueConfig['allowAvatarGallery'])) { return null; } $name = $field->name; $nameapproved = $field->name . 'approved'; $required = $this->_isRequired($field, $user, $reason); $existingAvatar = false; if ($user && $user->id) { // we can not trust the following, as if another field did error out, it's wrong: // $existingAvatar = ( $user->$name != null ); // so load from database: $realDatabaseUser = new moscomprofilerUser($_CB_database); if ($realDatabaseUser->load((int) $user->id)) { $existingAvatar = $realDatabaseUser->{$name} != null; } } $html = '<div>'; $choices = array(); if ($reason == 'register' || $reason == 'edit' && $user->id == 0) { if ($required == 0) { $choices[] = moscomprofilerHTML::makeOption('', _UE_AVATAR_NONE); } } else { if ($existingAvatar || $required == 0) { $choices[] = moscomprofilerHTML::makeOption('', _UE_AVATAR_NO_CHANGE); } } if ($name != 'avatar' || $ueConfig['allowAvatarUpload']) { $choices[] = moscomprofilerHTML::makeOption('upload', $existingAvatar ? _UE_AVATAR_UPLOAD_NEW : _UE_AVATAR_UPLOAD); } if ($name == 'avatar' && $ueConfig['allowAvatarGallery']) { $choices[] = moscomprofilerHTML::makeOption('gallery', _UE_AVATAR_SELECT); } if ($_CB_framework->getUi() == 2 && $existingAvatar && $user->{$nameapproved} == 0) { $choices[] = moscomprofilerHTML::makeOption('approve', _UE_APPROVE_IMAGE); } if ($existingAvatar && $required == 0) { $choices[] = moscomprofilerHTML::makeOption('delete', _UE_DELETE_AVATAR); } $html .= '<div>'; if ($reason != 'register' && $user->id != 0 && $existingAvatar) { $html .= $this->_avatarHtml($field, $user, $reason) . ' '; } if ($reason == 'edit' && $existingAvatar && $user->{$nameapproved} == 0 && isModerator($_CB_framework->myId())) { $html .= $this->_avatarHtml($field, $user, $reason, false, 10) . ' '; } if (count($choices) > 1) { $additional = ' class="inputbox"'; if ($_CB_framework->getUi() == 1 && $reason == 'edit' && $field->readonly) { $additional .= ' disabled="disabled"'; } $html .= moscomprofilerHTML::selectList($choices, $name . '__choice', $additional, 'value', 'text', '', $required, true, false); /* $js = " $('#cbimg_upload_" . $name . ",#cbimg_gallery_" . $name . "').hide();" . "\n $('#" . $name . "__choice').click( function() {" . "\n var choice = $(this).val();" . "\n if ( choice == '' ) {" . "\n $('#cbimg_upload_" . $name . "').slideUp('slow');" . "\n $('#cbimg_gallery_" . $name . "').slideUp('slow');" . "\n } else if ( choice == 'upload' ) {" . "\n $('#cbimg_upload_" . $name . "').slideDown('slow');" . "\n $('#cbimg_gallery_" . $name . "').slideUp('slow');" . "\n } else if ( choice == 'gallery' ) {" . "\n $('#cbimg_upload_" . $name . "').slideUp('slow');" . "\n $('#cbimg_gallery_" . $name . "').slideDown('slow');" . "\n }" . "\n } ).click();" ; */ static $functOut = false; if (!$functOut) { $js = "function cbslideImage(choice,uplodid,galleryid) {" . "\n\tif ( ( choice == '' ) || ( choice == 'approve' ) || ( choice == 'delete' ) ) {" . "\n\t\t\$(uplodid).slideUp('slow');" . "\n\t\t\$(galleryid).slideUp('slow');" . "\n\t} else if ( choice == 'upload' ) {" . "\n\t\t\$(uplodid).slideDown('slow');" . "\n\t\t\$(galleryid).slideUp('slow');" . "\n\t} else if ( choice == 'gallery' ) {" . "\n\t\t\$(uplodid).slideUp('slow');" . "\n\t\t\$(galleryid).slideDown('slow');" . "\n\t}" . "\n}"; $_CB_framework->outputCbJQuery($js); $functOut = true; } $js = "\$('#cbimg_upload_" . $name . ",#cbimg_gallery_" . $name . "').hide();" . "\n\t{" . "\n\t \$('#" . $name . "__choice').click( function() {" . "\n\t\tcbslideImage( \$(this).val(), '#cbimg_upload_" . $name . "', '#cbimg_gallery_" . $name . "' );" . "\n\t } ).click();" . "\n\t \$('#" . $name . "__choice').change( function() {" . "\n\t\tcbslideImage( \$(this).val(), '#cbimg_upload_" . $name . "', '#cbimg_gallery_" . $name . "' );" . "\n\t } );" . "\n\t}"; $_CB_framework->outputCbJQuery($js); } else { $html .= '<input type="hidden" name="' . $name . '__choice" value="' . $choices[0]->value . '" />'; } $html .= $this->_fieldIconsHtml($field, $user, 'htmledit', $reason, 'select', '', null, '', array(), $displayFieldIcons, $required); $html .= '</div>'; if ($name != 'avatar' || $ueConfig['allowAvatarUpload']) { $button = $reason == 'register' ? _UE_REGISTER : ($_CB_framework->getUi() == 2 ? _UE_SAVE : _UE_UPDATE); $saveFieldName = $field->name; $saveFieldRequired = $field->required; $field->name .= '__file'; if ($field->required && $user && isset($user->{$saveFieldName}) && $user->{$saveFieldName}) { $field->required = 0; } $html .= '<div id="cbimg_upload_' . $name . '">' . '<p>' . sprintf(_UE_UPLOAD_DIMENSIONS_AVATAR, $this->_getImageFieldParam($field, 'avatarWidth'), $this->_getImageFieldParam($field, 'avatarHeight'), $this->_getImageFieldParam($field, 'avatarSize')) . '</p>' . '<div>' . _UE_UPLOAD_SELECT_FILE . ' ' . '<input type="file" name="' . $name . '__file" value="" class="inputbox" />' . '</div>' . '<p>' . ($ueConfig['reg_enable_toc'] ? sprintf(_UE_AVATAR_DISCLAIMER_TERMS, $button, "<a href='" . cbSef(htmlspecialchars($ueConfig['reg_toc_url'])) . "' target='_BLANK'> " . _UE_AVATAR_TOC_LINK . "</a>") : sprintf(_UE_AVATAR_DISCLAIMER, $button)) . '</p>' . '</div>'; $field->name = $saveFieldName; $field->required = $saveFieldRequired; } if ($name == 'avatar' && $ueConfig['allowAvatarGallery']) { $live_site = $_CB_framework->getCfg('live_site'); $avatar_gallery_path = $_CB_framework->getCfg('absolute_path') . '/images/comprofiler/gallery'; $avatar_images = array(); $avatar_images = display_avatar_gallery($avatar_gallery_path); $html .= '<div id="cbimg_gallery_' . $name . '">' . "\n\t<table width='100%' border='0' cellpadding='4' cellspacing='2'>" . "\n\t\t<tr align='center' valign='middle'>"; for ($i = 0; $i < count($avatar_images); $i++) { $j = $i + 1; $avatar_name = ucfirst(str_replace('_', ' ', preg_replace('/^(.*)\\..*$/', '\\1', $avatar_images[$i]))); $html .= "\n\t\t\t<td>" . '<input type="radio" name="' . $name . '__gallery" id="' . $name . '__gallery_' . $i . '" value="' . $avatar_images[$i] . '" />' . '<label for="' . $name . '__gallery_' . $i . '">' . '<img src="' . $live_site . '/images/comprofiler/gallery/' . $avatar_images[$i] . '" alt="' . $avatar_name . '" title="' . $avatar_name . '" />' . '</label>' . '</td>'; if (function_exists('fmod')) { if (!fmod($j, 5)) { $html .= "</tr>\n\t\t<tr align=\"center\" valign=\"middle\">"; } } else { if (!fmodReplace($j, 5)) { // PHP < 4.2.0... $html .= "</tr>\n\t\t<tr align=\"center\" valign=\"middle\">"; } } } $html .= "\n\t\t</tr>\n\t\t" . "\n\t</table>" . '</div>'; } $html .= '</div>'; return $html; }
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&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&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"> </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() ? '' : '&user='******'\';" />'; echo '</td></tr>'; echo "\n\t</table>"; echo "\n"; echo cbGetSpoofInputTag('userAvatar'); echo "</form>\n"; } }
main(); } if (isset($_POST['wait'])) { include 'admin/modules/users_wait.inc'; } else { if (isset($_POST['susdel'])) { include 'admin/modules/users_susdel.inc'; } else { if (isset($_POST['avatargallery']) || isset($_GET['avatargallery'])) { $pagetitle .= ' ' . _BC_DELIM . ' ' . _EDITUSER; showheader(); require 'modules/Your_Account/avatars.php'; if (!($memberinfo = getusrdata($_GET['id']))) { echo _NOINFOFOR . ' <strong>' . $_GET['id'] . '</strong>'; } else { display_avatar_gallery($memberinfo); } showfooter(); } else { if (isset($_POST['save'])) { if ($CPG_SESS['admin']['page'] != 'users') { cpg_error(_ERROR_BAD_LINK, _SEC_ERROR); } if (!($memberinfo = getusrdata($_POST['id']))) { echo _NOINFOFOR . ' <strong>' . $username . '</strong>'; showfooter(); } else { $module_name = 'Your_Account'; require 'modules/Your_Account/edit_profile.php'; saveuser($memberinfo); }
account_login(_LOGININCOR); } } elseif (isset($_GET['profile']) && !empty($_GET['profile'])) { require_once "{$filepath}/userinfo.php"; userinfo($_GET['profile']); } elseif ($op == 'userinfo' && isset($_GET['username']) && !empty($_GET['username'])) { require_once "{$filepath}/userinfo.php"; userinfo($_GET['username']); } elseif ($op == 'logout') { $pagetitle .= ' ' . _BC_DELIM . ' ' . _LOGOUT; $redir = isset($_GET['redirect']) ? $CPG_SESS['user']['uri'] : $mainindex; cpg_error(_YOUARELOGGEDOUT, _YOUARELOGGEDOUT, $redir); } elseif (is_user()) { if (isset($_POST['avatargallery']) || isset($_GET['avatargallery'])) { require_once "{$filepath}/avatars.php"; display_avatar_gallery($userinfo); } elseif (isset($_GET['edit'])) { require_once "{$filepath}/edit_profile.php"; edituser($userinfo); } elseif (isset($_POST['save'])) { require_once "{$filepath}/edit_profile.php"; saveuser($userinfo); } else { switch ($op) { case 'edithome': edithome(); break; case 'editcomm': editcomm(); break; case 'savehome':