Example #1
0
function echo_general_tab()
{
    global $uid, $pguser, $userP;
    global $u_n;
    $options = get_locale_translation_selection_options();
    $u_intlang_options[""] = BROWSER_DEFAULT_STR;
    $u_intlang_options = array_merge($u_intlang_options, $options);
    $i_stats_privacy = array(PRIVACY_PUBLIC => _("Public"), PRIVACY_ANONYMOUS => _("Anonymous"), PRIVACY_PRIVATE => _("Private"));
    $user = new User($pguser);
    echo "<tr>\n";
    show_preference(_('Name'), 'real_name', 'name', $user->real_name, 'textfield', array('20', ''));
    show_blank();
    echo "</tr>\n";
    // Check for DP/forum email mismatch, warn user if not the same
    $bb_user_info = get_forum_user_details($pguser);
    $email_warning = '';
    if ($bb_user_info["email"] != $user->email) {
        $edit_url = get_url_to_edit_profile();
        $email_warning = "<p><b>" . sprintf(_("Warning: The email in your <a href='%s'>forum profile</a> is different."), $edit_url) . "</b><br>";
        $email_warning .= _("Please update if necessary to ensure you receive messages as intended.") . "</p>\n";
    }
    echo "<tr>\n";
    show_preference(_('E-mail'), 'email', 'email', $user->email, 'textfield', array('26', $email_warning));
    show_preference(_('Interface Language'), 'u_intlang', 'intlang', $userP['u_intlang'], 'dropdown', $u_intlang_options);
    echo "</tr>\n";
    echo "<tr>\n";
    show_preference(_('E-mail Updates'), 'email_updates', 'updates', $userP['email_updates'], 'radio_group', array(1 => _("Yes"), 0 => _("No")));
    $theme_options = array();
    $result = mysql_query("SELECT * FROM themes");
    while ($row = mysql_fetch_array($result)) {
        $option_value = $row['unixname'];
        $option_label = $row['name'];
        $theme_options[$option_value] = $option_label;
    }
    show_preference(_('Theme'), 'i_theme', 'theme', $userP['i_theme'], 'dropdown', $theme_options);
    echo "</tr>\n";
    echo "<tr>\n";
    show_link_as_if_preference(_('Password'), 'password', get_reset_password_url(), _("Reset Password"));
    show_preference(_('Statistics Bar Alignment'), 'u_align', 'align', $userP['u_align'], 'radio_group', array(1 => _("Left"), 0 => _("Right")));
    echo "</tr>\n";
    echo "<tr>\n";
    show_preference(_('Statistics'), 'u_privacy', 'privacy', $userP['u_privacy'], 'dropdown', $i_stats_privacy);
    show_preference(_('Show Rank Neighbors'), 'u_neigh', 'neighbors', $userP['u_neigh'], 'dropdown', $u_n);
    echo "</tr>\n";
    echo "<tr>\n";
    show_preference(_('Credits Wanted'), NULL, 'creditswanted', NULL, 'credits_wanted_adhoc', NULL);
    show_blank();
    echo "</tr>\n";
    echo "<tr>\n";
    show_preference(_('Credit Name'), NULL, 'creditname', NULL, 'credit_name_adhoc', NULL);
    show_blank();
    echo "</tr>\n";
    echo_bottom_button_row();
}
Example #2
0
function do_event_subscriptions()
{
    global $project, $code_url, $subscribable_project_events, $pguser;
    $projectid = $project->projectid;
    echo "<a name='event_subscriptions'></a>\n";
    echo "<h4>", _("Event Subscriptions"), "</h4>\n";
    echo "<div style='margin-left:3em'>\n";
    $user_email_address = get_forum_email_address($pguser);
    echo "<p>";
    echo _("Here you can sign up to be notified when certain events happen to this project.");
    echo "\n";
    echo sprintf(_("Notifications will be sent to your email address, which is currently &lt;%s&gt;. (If this is not correct, please visit <a href='%s'>your profile</a>.)"), $user_email_address, get_url_to_edit_profile());
    echo "\n";
    echo _("Your current subscriptions are shown below with a shaded background.");
    echo "</p>\n";
    $n_users_subscribed_to_ = get_n_users_subscribed_to_events_for_project($projectid);
    $url = "{$code_url}/tools/set_project_event_subs.php";
    echo "<form method='post' action='{$url}'>\n";
    echo "<input type='hidden' name='projectid' value='{$projectid}'>\n";
    echo "<input type='hidden' name='return_uri' value='" . urlencode($_SERVER['REQUEST_URI']) . "#event_subscriptions'>\n";
    echo "<table>\n";
    echo "<tr>";
    echo "<th>", _("Event"), "</th>";
    echo "<th>", _("Subscribed?"), "</th>";
    echo "<th>", _("Users Subscribed"), "</th>";
    echo "</tr>\n";
    foreach ($subscribable_project_events as $event => $label) {
        $is_subd = user_is_subscribed_to_project_event($pguser, $projectid, $event);
        $bgcolor = $is_subd ? '#CFC' : '#FFF';
        $checked = $is_subd ? 'checked' : '';
        echo "<tr>";
        echo "<td>{$label}</td>";
        echo "<td style='text-align:center; background-color:{$bgcolor};'><input type='checkbox' name='{$event}' {$checked}></td>";
        echo "<td style='text-align:center;'>{$n_users_subscribed_to_[$event]}</td>";
        echo "</tr>\n";
    }
    echo "</table>\n";
    echo "<input type='submit' value='", attr_safe(_("Update Event Subscriptions")), "'>\n";
    echo "</form>\n";
    echo "</div>\n";
}