Example #1
0
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&amp;mode=edit&amp;edit=profile&amp;id=' . $userinfo['user_id']) . '">' . _MA_PROFILE_INFO . '</a>') . ' |
		' . ($mode == 'reg_details' ? '<strong>' . _MA_REGISTRATION_INFO . '</strong>' : '<a href="' . URL::admin('users&amp;mode=edit&amp;edit=reg_details&amp;id=' . $userinfo['user_id']) . '">' . _MA_REGISTRATION_INFO . '</a>') . ' |
		' . ($mode == 'avatar' ? '<strong>' . _AVATAR_CONTROL . '</strong>' : '<a href="' . URL::admin('users&amp;mode=edit&amp;edit=avatar&amp;id=' . $userinfo['user_id']) . '">' . _AVATAR_CONTROL . '</a>') . ' |
		' . ($mode == 'admin' ? '<strong>' . _MA_PRIVILEGES . '</strong>' : '<a href="' . URL::admin('users&amp;mode=edit&amp;edit=admin&amp;id=' . $userinfo['user_id']) . '">' . _MA_PRIVILEGES . '</a>') . '
		<br /><br />';
        $action = URL::admin('users&amp;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" />&nbsp;<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>&nbsp;&nbsp;
	  <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>&nbsp;&nbsp;
	  <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>&nbsp;&nbsp;
	  <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" />&nbsp;&nbsp;<input type="reset" value="' . _RESET . '" name="reset" class="liteoption" />
		</td>
	</tr>
</table></form>
';
}
Example #2
0
function register_form()
{
    global $db, $user_prefix, $CPG_SESS, $user_cfg, $userinfo, $MAIN_CFG;
    $coppa = empty($_GET['coppa']) ? 0 : true;
    $registerinfo['username']['text'] = _USERNAME;
    $registerinfo['username']['length'] = 25;
    $registerinfo['username']['type'] = 'text';
    $registerinfo['email']['text'] = _EMAILADDRESS;
    $registerinfo['email']['length'] = 255;
    $registerinfo['email']['type'] = 'text';
    $registerinfo['password']['text'] = _PASSWORD;
    $registerinfo['password']['msg'] = '<br />' . _BLANKFORAUTO;
    $registerinfo['password']['length'] = 20;
    $registerinfo['password']['type'] = 'password';
    $registerinfo['password_confirm']['text'] = _CONFIRMPASSWORD;
    $registerinfo['password_confirm']['length'] = 20;
    $registerinfo['password_confirm']['type'] = 'password';
    echo '<form action="' . URL::index("&amp;file=register") . '" method="post" enctype="multipart/form-data" accept-charset="utf-8">
<table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
  <tr>
	<td class="row2" colspan="2"><span class="gensmall">' . _MA_ITEMS_REQUIRED . '</span></td>
  </tr>';
    while (list($field, $info) = each($registerinfo)) {
        echo '<tr>
	<td class="row1" width="38%"><span class="gen">' . $info['text'] . ': *</span>' . (isset($info['msg']) ? $info['msg'] : '') . '</td>
	<td class="row2"><input type="' . $info['type'] . '" class="post" style="width:200px" name="' . $field . '" id="register-' . $field . '" size="25" maxlength="' . $info['length'] . '" /></td>
  </tr>';
    }
    // Add the additional fields to form if activated
    $result = $db->sql_query("SELECT * FROM " . $user_prefix . "_users_fields WHERE visible > 0 ORDER BY section");
    if ($db->sql_numrows($result)) {
        $settings = 0;
        while ($row = $db->sql_fetchrow($result)) {
            if ($row['type'] == 7 && !$user_cfg['allowusertheme']) {
                continue;
            }
            if ($row['field'] == 'user_lang' && !$MAIN_CFG['global']['multilingual']) {
                continue;
            }
            if ($row['section'] == 3 && !$settings) {
                $settings = 3;
                echo '<tr><th class="thSides" colspan="2" height="25" valign="middle">' . _MA_PRIVATE . '</th></tr>';
            } else {
                if ($row['section'] == 5 && $settings != 5) {
                    $settings = 5;
                    echo '<tr><th class="thSides" colspan="2" height="25" valign="middle">' . _MA_PREFERENCES . '</th></tr>';
                }
            }
            $info = $row['langdef'];
            if (defined($info)) {
                $info = constant($info);
            }
            $info .= $row['visible'] == 2 ? ': *' : ':';
            echo '<tr>
	<td class="row1"><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>';
        }
    }
    echo '<tr>
	<td class="catBottom" colspan="2" align="center" height="28">
	  <input type="hidden" name="agreed" value="1" />
	  <input type="hidden" name="coppa" value="' . $coppa . '" />
	  <input type="submit" name="submit" value="' . _SUBMIT . '" class="mainoption" />&nbsp;&nbsp;
	  <input type="reset" value="' . _RESET . '" name="reset" class="liteoption" /></td>
  </tr>
</table>
</form>
';
}