function userinfo($username) { global $db, $prefix, $user_prefix, $currentlang, $pagetitle, $MAIN_CFG, $CPG_SESS, $CLASS, $cpgtpl; $owninfo = is_user() && ($username == is_user() || strtolower($username) == strtolower($CLASS['member']->members[is_user()]['username'])); if ($owninfo) { $userinfo =& $CLASS['member']->members[is_user()]; global $Blocks; $block = array('bid' => 10000, 'view' => 1, 'side' => 'l', 'title' => _TB_BLOCK, 'content' => member_block()); $Blocks->custom($block); $block = NULL; } else { if (!is_user() && $username != 'Anonymous') { URL::redirect(URL::index('&profile=Anonymous')); } else { if (!($userinfo = getusrdata($username)) || $userinfo['user_level'] < 1) { require_once 'header.php'; OpenTable(); echo _NOINFOFOR . ' <strong>' . htmlspecialchars($username) . '</strong>'; if (!$userinfo) { echo '<br /><br /><em>' . _MA_USERNOEXIST . '</em>'; } elseif ($userinfo['user_level'] == 0) { echo '<br /><br /><em>' . _ACCSUSPENDED . '</em>'; } elseif ($userinfo['user_level'] == -1) { echo '<br /><br /><em>' . _ACCDELETED . '</em>'; } CloseTable(); return; } } } $username = $userinfo['username']; $imgpath = 'themes/' . $CPG_SESS['theme'] . '/images/forums/lang_'; $imgpath .= file_exists($imgpath . $currentlang . '/icon_email.gif') ? $currentlang : 'english'; if ($owninfo) { $pagetitle .= ' ' . _BC_DELIM . ' ' . $username . ', ' . _THISISYOURPAGE; } else { $pagetitle .= ' ' . _BC_DELIM . ' ' . _PERSONALINFO . ' ' . _BC_DELIM . ' ' . $username; } require_once 'header.php'; require_once CORE_PATH . 'nbbcode.php'; if ($userinfo['user_avatar_type'] == 1) { $avatar = $MAIN_CFG['avatar']['path'] . '/' . $userinfo['user_avatar']; } else { if ($userinfo['user_avatar_type'] == 2) { $avatar = $userinfo['user_avatar']; } else { if ($userinfo['user_avatar_type'] == 3 && !empty($userinfo['user_avatar'])) { $avatar = $MAIN_CFG['avatar']['gallery_path'] . '/' . $userinfo['user_avatar']; } else { $avatar = $MAIN_CFG['avatar']['gallery_path'] . '/' . $MAIN_CFG['avatar']['default']; } } } if ($avatar) { $avatar = '<img src="' . $avatar . '" alt="" />'; } if ($userinfo['user_website']) { if (false === strpos($userinfo['user_website'], '://')) { $userinfo['user_website'] = "http://{$userinfo['user_website']}"; } } if (!preg_match('#^(http[s]?\\:\\/\\/)?([a-z0-9\\-\\.]+)?[a-z0-9\\-]+\\.[a-z]{2,4}$#i', $userinfo['user_website'])) { $userinfo['user_website'] = ''; } if ($userinfo['user_rank']) { $sql = 'rank_id = ' . $userinfo['user_rank'] . ' AND rank_special = 1'; } else { $sql = 'rank_min <= ' . intval($userinfo['user_posts']) . ' AND rank_special = 0 ORDER BY rank_min DESC'; } list($poster_rank, $rank_image) = $db->sql_ufetchrow('SELECT rank_title, rank_image FROM ' . $prefix . '_bbranks WHERE ' . $sql, SQL_NUM); $poster_rank = $rank_image ? '<img src="' . $rank_image . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" />' : $poster_rank; if (can_admin('members') || $owninfo) { $result = $db->sql_query("SELECT field, langdef, type FROM " . $user_prefix . "_users_fields WHERE section = 2 OR section = 3"); } else { $result = $db->sql_query("SELECT field, langdef, type FROM " . $user_prefix . "_users_fields WHERE section = 2"); } if ($db->sql_numrows($result) > 0) { while ($row = $db->sql_fetchrow($result)) { if ($row['type'] == 1) { $value = $userinfo[$row['field']] ? _YES : _NO; } else { $value = $userinfo[$row['field']]; } if (defined($row['langdef'])) { $row['langdef'] = constant($row['langdef']); } $cpgtpl->assign_block_vars('custom_field', array('NAME' => $row['langdef'], 'VALUE' => $value)); } } $blog_url = 0; if (is_active('Blogs')) { list($num_blogs) = $db->sql_ufetchrow("SELECT COUNT(*) FROM " . $prefix . "_blogs \n\t\tWHERE aid='{$username}' AND private=0"); if ($num_blogs > 0) { $blog_url = 1; } } $show_email = 0; if ($userinfo['user_viewemail'] && is_user() || $owninfo || is_admin() && !$CLASS['member']->demo) { $email = $userinfo['user_email']; } else { if ($userinfo['femail']) { $email = $userinfo['femail']; } } if (isset($email) && Security::check_email($email)) { $email = 'mailto:' . $email; if (!$owninfo && is_user()) { define('IN_PHPBB', true); define('PHPBB_INSTALLED', true); $phpbb_root_path = "./modules/Forums/"; require_once $phpbb_root_path . 'common.php'; global $board_config; if ($board_config['board_email_form']) { $email = URL::index('Forums&file=profile&mode=email&u=' . $userinfo['user_id']); } } $show_email = 1; } $show_pm = 0; if (!$owninfo && is_user() && is_active('Private_Messages')) { $show_pm = 1; } $show_gallery = 0; if (is_active('coppermine')) { $user_gallery = 10000 + $userinfo['user_id']; $ugall_result = $db->sql_query("SELECT p.pid FROM " . $prefix . "_cpg_pictures AS p, " . $prefix . "_cpg_albums AS a WHERE a.aid = p.aid AND a.category = {$user_gallery}"); if ($db->sql_numrows($ugall_result) > 0) { $show_gallery = 1; } } $cpgtpl->assign_vars(array('ABOUT_USER' => _ABOUT_USER . $username, 'AVATAR' => $avatar, 'JOINED_DATE' => formatDateTime($userinfo['user_regdate'], _DATESTRING3), 'USER_RANK' => $poster_rank, 'USER_LOCATION' => decode_bb_all($userinfo['user_from']), 'USER_WEBSITE' => $userinfo['user_website'], 'USER_OCCUPATION' => decode_bb_all($userinfo['user_occ']), 'USER_INTERESTS' => decode_bb_all($userinfo['user_interests']), 'USER_SIGNATURE' => $userinfo['user_sig'] ? decode_bb_all($userinfo['user_sig'], 1, false) : false, 'USER_EXTRA_INFO' => $userinfo['bio'] ? decode_bb_all($userinfo['bio'], 1, false) : false, 'BLOG_URL' => $blog_url ? URL::index('Blogs&mode=user&nick=' . $username) : false, 'EMAIL_ADDRESS' => $show_email ? $email : false, 'IMG_PATH' => $imgpath, 'U_PM' => $show_pm ? URL::index("Private_Messages&mode=post&u={$userinfo['user_id']}") : false, 'USER_MSNM' => $userinfo['user_msnm'], 'USER_YIM' => $userinfo['user_yim'], 'USER_AIM' => $userinfo['user_aim'], 'USER_ICQ' => $userinfo['user_icq'], 'USER_SKYPE' => $userinfo['user_skype'], 'USER_GALLERY' => $show_gallery ? URL::index('coppermine&cat=' . (10000 + $userinfo['user_id'])) : false, 'OWN_OR_CAN_ADMIN' => $owninfo || can_admin('members'), 'OWN_INFO' => $owninfo, 'SUBSCRIBED' => $userinfo['newsletter'], 'CAN_ADMIN_MEMBERS' => can_admin('members'), 'U_EDIT_USER' => URL::admin('users&mode=edit&edit=profile&id=' . $userinfo['user_id']), 'U_SUSPEND_USER' => URL::admin('users&mode=edit&edit=admin&id=' . $userinfo['user_id']), 'HEADLINES_ALLOWED' => $owninfo && $MAIN_CFG['member']['my_headlines'], 'URL_URI' => URL::uri(), 'SHOW_RSS' => false)); if ($owninfo && $MAIN_CFG['member']['my_headlines']) { $hid = isset($_POST['hid']) ? intval($_POST['hid']) : 0; $url = isset($_POST['url']) ? $_POST['url'] : ''; $sql4 = 'SELECT hid, sitename FROM ' . $prefix . '_headlines ORDER BY sitename'; $headl = $db->sql_query($sql4); while (list($nhid, $hsitename) = $db->sql_fetchrow($headl)) { $sel = $hid == $nhid ? ' selected="selected"' : ''; $cpgtpl->assign_block_vars('feed_option', array('VALUE' => $nhid, 'SELECTED' => $sel, 'NAME' => $hsitename)); } if ($hid > 0 || $hid == 0 && strlen($url) > 10) { if ($hid > 0) { $sql5 = 'SELECT sitename, headlinesurl FROM ' . $prefix . "_headlines WHERE hid='{$hid}'"; $result5 = $db->sql_query($sql5); list($title, $url) = $db->sql_fetchrow($result5); $siteurl = str_ireplace('http://', '', $url); $siteurl = explode('/', $siteurl); } else { if (false === strpos($url, '://')) { $url = 'http://' . $url; } $siteurl = str_ireplace('http://', '', $url); $siteurl = explode('/', $siteurl); $title = 'http://' . $siteurl[0]; } include_once CORE_PATH . 'classes/rss.php'; $content = CPG_RSS::display($url); $cpgtpl->assign_vars(array('SHOW_RSS' => true, 'RSS_CONTENT' => $content, 'RSS_URL' => $siteurl[0], 'RSS_TITLE' => $title)); } } $cpgtpl->set_handle('userinfo', 'your_account/userinfo.html'); $cpgtpl->display('userinfo'); $blocksdir = dir('modules/Your_Account/blocks'); while ($func = $blocksdir->read()) { if (substr($func, -3) == 'php') { $blockslist[] = $func; } } closedir($blocksdir->handle); natcasesort($blockslist); for ($i = 0; $i < sizeof($blockslist); $i++) { require_once 'modules/Your_Account/blocks/' . $blockslist[$i]; } }
function edituser(&$userinfo) { global $db, $prefix, $user_prefix, $pagetitle, $allowmailchange, $allowusertheme; $mode = isset($_GET['edit']) ? $_GET['edit'] : 'profile'; if ($mode == 'admin' && !defined('ADMIN_PAGES')) { $mode = 'profile'; } if ($mode == 'reg_details') { $pagetitle .= ' ' . _BC_DELIM . ' ' . _MA_REGISTRATION_INFO; } elseif ($mode == 'profile') { $section = 'section=1 OR section=2'; $pagetitle .= ' ' . _BC_DELIM . ' ' . _MA_PROFILE_INFO; } elseif ($mode == 'private') { $section = 'section=3'; $pagetitle .= ' ' . _BC_DELIM . ' ' . _MA_PRIVATE; } elseif ($mode == 'prefs') { $section = 'section=5'; $pagetitle .= ' ' . _BC_DELIM . ' ' . _MA_PREFERENCES; } elseif ($mode == 'avatar') { $pagetitle .= ' ' . _BC_DELIM . ' ' . _AVATAR_CONTROL; } else { if (!defined('ADMIN_PAGES')) { URL::redirect(URL::index('Your_Account')); } } if (!defined('ADMIN_PAGES')) { global $Blocks; $block = array('bid' => 10000, 'view' => 1, 'side' => 'l', 'title' => _TB_BLOCK, 'content' => member_block()); $Blocks->custom($block); $block = NULL; require_once 'header.php'; $action = URL::index(); } else { echo "<strong>{$userinfo['username']}</strong>"; if ($userinfo['user_level'] == 0) { echo ' (' . _ACCTSUSPEND . ')'; } elseif ($userinfo['user_level'] < 0) { echo ' (' . _ACCTDELETE . ')'; } echo '<br /> ' . ($mode == 'profile' ? '<strong>' . _MA_PROFILE_INFO . '</strong>' : '<a href="' . URL::admin('users&mode=edit&edit=profile&id=' . $userinfo['user_id']) . '">' . _MA_PROFILE_INFO . '</a>') . ' | ' . ($mode == 'reg_details' ? '<strong>' . _MA_REGISTRATION_INFO . '</strong>' : '<a href="' . URL::admin('users&mode=edit&edit=reg_details&id=' . $userinfo['user_id']) . '">' . _MA_REGISTRATION_INFO . '</a>') . ' | ' . ($mode == 'avatar' ? '<strong>' . _AVATAR_CONTROL . '</strong>' : '<a href="' . URL::admin('users&mode=edit&edit=avatar&id=' . $userinfo['user_id']) . '">' . _AVATAR_CONTROL . '</a>') . ' | ' . ($mode == 'admin' ? '<strong>' . _MA_PRIVILEGES . '</strong>' : '<a href="' . URL::admin('users&mode=edit&edit=admin&id=' . $userinfo['user_id']) . '">' . _MA_PRIVILEGES . '</a>') . ' <br /><br />'; $action = URL::admin('users&id=' . $userinfo['user_id']); } if (false === strpos($userinfo['user_website'], '://') && !empty($userinfo['user_website'])) { $userinfo['user_website'] = "http://{$userinfo['user_website']}"; } global $MAIN_CFG; $MAIN_CFG['avatar']['allow_upload'] = ini_get('file_uploads') == '0' || strtolower(ini_get('file_uploads') == 'off') ? false : $MAIN_CFG['avatar']['allow_upload']; $form_enctype = $MAIN_CFG['avatar']['allow_upload'] ? 'enctype="multipart/form-data"' : ''; echo '<form action="' . $action . '" method="post" name="Profile" ' . $form_enctype . ' accept-charset="utf-8"> <table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">'; if ($mode == 'reg_details') { if (defined('ADMIN_PAGES')) { $userinfo['username'] = '******' . $userinfo['username'] . '" size="25" maxlength="25" class="post" style="width:200px" />'; } echo '<tr> <td class="row1" width="40%"><span class="gen">' . _USERNAME . '</span></td><td class="row2"><b>' . $userinfo['username'] . '</b></td> </tr><tr> <td class="row1"><span class="gen">' . _EMAILADDRESS . '</span></td> <td class="row2">'; if (defined('ADMIN_PAGES') || $allowmailchange) { echo '<input type="text" name="user_email" value="' . $userinfo['user_email'] . '" size="25" maxlength="255" class="post" style="width:200px" />'; } else { echo '<b>' . $userinfo['user_email'] . "</b><input type=\"hidden\" name=\"user_email\" value=\"{$userinfo['user_email']}\" />"; } if (!defined('ADMIN_PAGES')) { echo '</td> </tr><tr> <td class="row1"><span class="gen">' . _CURRENTPASSWORD . '</span>' . (!$allowmailchange && !defined('ADMIN_PAGES') ? '<br />' . _CURRENTPASSWORDMSG : '') . '</td> <td class="row2"><input type="password" name="current_password" size="25" maxlength="20" class="post" style="width:200px" />'; } echo '</td> </tr><tr> <td class="row1"><span class="gen">' . _NEWPASSWORD . '</span><br />' . _NEWPASSWORDMSG . '</td> <td class="row2"><input type="password" name="new_password" size="25" maxlength="20" class="post" style="width:200px" /></td> </tr><tr> <td class="row1"><span class="gen">' . _CONFIRMPASSWORD . '</span><br />' . _CONFIRMPASSWORDMSG . '</td> <td class="row2"><input type="password" name="verify_password" size="25" maxlength="20" class="post" style="width:200px" /></td> </tr>'; } elseif ($mode == 'avatar') { if (isset($_POST['submitavatar']) && isset($_POST['avatarselect'])) { $user_avatar = $_POST['avatarselect']; $user_avatar_type = 3; } else { $user_avatar = $userinfo['user_avatar']; $user_avatar_type = $userinfo['user_avatar_type']; } if ($user_avatar_type == 1) { $avatar = $MAIN_CFG['avatar']['path'] . '/' . $user_avatar; } elseif ($user_avatar_type == 2) { $avatar = $user_avatar; } elseif ($user_avatar_type == 3) { $avatar = $MAIN_CFG['avatar']['gallery_path'] . '/' . $user_avatar; } else { $avatar = $MAIN_CFG['avatar']['gallery_path'] . '/' . $MAIN_CFG['avatar']['default']; } echo '<tr> <td class="row1" width="40%"><span class="gensmall">' . _AVATAR_INFO . '</span></td> <td class="row1" align="center"><span class="gen">' . _CURRENT_IMAGE . '</span><br /><br /><img src="' . $avatar . '" name="avatar" alt="" /><br /><br />'; if ($user_avatar_type != 0) { echo '<input type="checkbox" name="avatardel" /> <span class="gensmall">' . _DELETE_IMAGE . '</span>'; } echo '</td> </tr>'; if ($MAIN_CFG['avatar']['allow_remote']) { echo '<tr> <td class="row1"><span class="gen">' . _AVATAR_OFFSITE . ':</span><br /><span class="gensmall">' . _AVATAR_OFFSITEMSG . '</span></td> <td class="row2"><input type="text" name="avatarremoteurl" size="40" class="post" style="width: 300px" /></td> </tr>'; } if ($MAIN_CFG['avatar']['allow_local']) { echo '<tr> <td class="row1"><span class="gen">' . _AVATAR_SELECT . ':</span></td> <td class="row2"><input type="hidden" name="user_avatar" value="' . $user_avatar . '" /><input type="submit" name="avatargallery" value="' . _SHOW_GALLERY . '" class="liteoption" /></td> </tr>'; } if ($MAIN_CFG['avatar']['allow_upload']) { echo '<tr> <td class="row1"><span class="gen">' . _AVATAR_UPLOAD_URL . ':</span></td> <td class="row2"><input type="text" name="avatarurl" size="40" class="post" style="width: 300px" /></td> </tr><tr> <td class="row1"><span class="gen">' . _AVATAR_UPLOAD . ':</span></td> <td class="row2"><input type="hidden" name="MAX_FILE_SIZE" value="' . $MAIN_CFG['avatar']['filesize'] . '" /><input type="file" name="avatar" size="40" class="post" /></td> </tr>'; } } elseif ($mode == 'admin') { $result = $db->sql_query('SELECT * FROM ' . $prefix . '_bbranks WHERE rank_special = 1 ORDER BY rank_title'); $rank_select[0] = 'No special rank assigned'; while ($row = $db->sql_fetchrow($result)) { $rank_select[$row['rank_id']] = $row['rank_title']; } $db->sql_freeresult($result); $sel[0] = $userinfo['user_allow_pm'] ? ' checked="checked"' : ''; $sel[1] = !$userinfo['user_allow_pm'] ? ' checked="checked"' : ''; $sel[2] = $userinfo['user_allowavatar'] ? ' checked="checked"' : ''; $sel[3] = !$userinfo['user_allowavatar'] ? ' checked="checked"' : ''; $sel[4] = $userinfo['user_level'] < 1 ? ' checked="checked"' : ''; $sel[5] = $userinfo['user_level'] > 0 ? ' checked="checked"' : ''; echo '<tr> <td class="row1" colspan="2"><span class="gensmall">These fields are not able to be modified by the users. Here you can set their status and other options that are not given to users.</span></td> </tr><tr> <td class="row1"><span class="gen">Can send Private Messages</span> <td class="row2"> <input type="radio" name="user_allow_pm" value="1"' . $sel[0] . ' /><span class="gen">' . _YES . '</span> <input type="radio" name="user_allow_pm" value="0"' . $sel[1] . ' /><span class="gen">' . _NO . '</span> </td> </tr><tr> <td class="row1"><span class="gen">Can display avatar</span> <td class="row2"> <input type="radio" name="user_allowavatar" value="1"' . $sel[2] . ' /><span class="gen">' . _YES . '</span> <input type="radio" name="user_allowavatar" value="0"' . $sel[3] . ' /><span class="gen">' . _NO . '</span> </td> </tr><tr> <td class="row1"><span class="gen">Rank Title</span> <td class="row2">' . select_box('user_rank', $userinfo['user_rank'], $rank_select) . '</td> </tr><tr> <td class="row1"><span class="gen">' . _SUSPENDUSER . '</span> <td class="row2"> <input type="radio" name="user_suspend" value="1"' . $sel[4] . ' /><span class="gen">' . _YES . '</span> <input type="radio" name="user_suspend" value="0"' . $sel[5] . ' /><span class="gen">' . _NO . '</span> </td> </tr><tr> <td class="row1" valign="top"><span class="gen">' . _SUSPENDREASON . '</span> <td class="row2"><textarea name="suspendreason" rows="5" cols="40" wrap="virtual">' . (isset($userinfo['susdel_reason']) ? $userinfo['susdel_reason'] : '') . '</textarea></td> </tr>'; } else { $result = $db->sql_query('SELECT * FROM ' . $user_prefix . '_users_fields WHERE ' . $section . ' ORDER BY section, fid'); if ($db->sql_numrows($result) > 0) { echo '<tr><td class="row1" colspan="2">' . _MA_ITEMS_REQUIRED . "</td></tr>\n"; while ($row = $db->sql_fetchrow($result)) { if ($row['type'] == 7 && !$allowusertheme) { continue; } if ($row['field'] == 'user_lang' && !$MAIN_CFG['global']['multilingual']) { continue; } $info = $row['langdef']; if (defined($info)) { $info = constant($info); } $info .= $row['visible'] == 2 ? ': *' : ':'; $align = $row['type'] == 2 ? ' valign="top"' : ''; echo '<tr><td class="row1"' . $align . ' width="40%"><span class="gen">' . $info . '</span>'; if (defined($row['langdef'] . 'MSG') != '') { echo '<br />' . constant($row['langdef'] . 'MSG'); } if ($row['field'] == 'user_timezone') { echo '<br /><br /><span class="gen">Daylight Saving Time</span> (<a href="http://webexhibits.org/daylightsaving/" target="_blank">' . strtolower(_TB_INFO) . '</a>):'; } echo '</td><td class="row2">' . ma_formfield($row['type'], $row['field'], $row['size'], $userinfo) . "</td></tr>\n"; } } } echo '<tr> <td class="catbottom" colspan="2" align="center" height="28"> <input type="hidden" name="id" value="' . $userinfo['user_id'] . '" /> <input type="hidden" name="save" value="' . $mode . '" /> <input type="submit" name="submit" value="' . _SAVECHANGES . '" class="mainoption" /> <input type="reset" value="' . _RESET . '" name="reset" class="liteoption" /> </td> </tr> </table></form> '; }
function editcomm() { global $userinfo, $pagetitle, $Blocks; $block = array('bid' => 10000, 'view' => 1, 'side' => 'l', 'title' => _TB_BLOCK, 'content' => member_block()); $Blocks->custom($block); $block = NULL; $pagetitle .= ' ' . _BC_DELIM . ' ' . _COMMENTSCONFIG; require_once 'header.php'; $cpgtpl->assign_vars(array('U_SAVECOMM' => URL::index('&op=savecomm'), 'S_UMODE' => select_box('umode', $userinfo['umode'], array('nocomments' => _NOCOMMENTS, 'nested' => _NESTED, 'flat' => _FLAT, 'thread' => _THREAD)), 'S_UORDER' => select_box('uorder', $userinfo['uorder'], array('0' => _OLDEST, '1' => _NEWEST, '2' => _HIGHEST)), 'S_THOLD' => select_box('thold', $userinfo['thold'], array('-1' => _UNCUT, '0' => _EVERYTHING, '1' => _FILTERMOSTANON, '2' => _USCORE . ' +2', '3' => _USCORE . ' +3', '4' => _USCORE . ' +4', '5' => _USCORE . ' +5')), 'S_NOSCORE' => yesno_option('noscore', $userinfo['noscore']), 'S_COMMENTMAX' => $userinfo['commentmax'])); $cpgtpl->set_handle('body', 'your_account/edit_comm.html'); $cpgtpl->display('body'); }