示例#1
0
function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_accounts_menu = true, $p_redirect_url = '')
{
    if (null === $p_user_id) {
        $p_user_id = auth_get_current_user_id();
    }
    $t_redirect_url = $p_redirect_url;
    if (is_blank($t_redirect_url)) {
        $t_redirect_url = 'account_prefs_page.php';
    }
    # protected account check
    if (user_is_protected($p_user_id)) {
        if ($p_error_if_protected) {
            trigger_error(ERROR_PROTECTED_ACCOUNT, ERROR);
        } else {
            return;
        }
    }
    if (!user_pref_exists($p_user_id)) {
        user_pref_set_default($p_user_id);
    }
    # prefix data with u_
    $t_pref = user_pref_get($p_user_id);
    # Account Preferences Form BEGIN
    ?>
<br />
<div align="center">
<form method="post" action="account_prefs_update.php">
<input type="hidden" name="user_id" value="<?php 
    echo $p_user_id;
    ?>
" />
<input type="hidden" name="redirect_url" value="<?php 
    echo $t_redirect_url;
    ?>
" />
<table class="width75" cellspacing="1">
<tr>
	<td class="form-title">
		<?php 
    echo lang_get('default_account_preferences_title');
    ?>
	</td>
	<td class="right">
		<?php 
    if ($p_accounts_menu) {
        print_account_menu('account_prefs_page.php');
    }
    ?>
	</td>
</tr>
<tr class="row-1">
	<td class="category" width="50%">
		<?php 
    echo lang_get('default_project');
    ?>
	</td>
	<td width="50%">
		<select name="default_project">
			<?php 
    print_project_option_list($t_pref->default_project);
    ?>
		</select>
	</td>
</tr>
<tr class="row-2">
	<td class="category">
		<?php 
    echo lang_get('advanced_report');
    ?>
	</td>
	<td>
		<input type="checkbox" name="advanced_report" <?php 
    check_checked($t_pref->advanced_report, ON);
    ?>
 />
	</td>
</tr>
<tr class="row-1">
	<td class="category">
		<?php 
    echo lang_get('advanced_view');
    ?>
	</td>
	<td>
		<input type="checkbox" name="advanced_view" <?php 
    check_checked($t_pref->advanced_view, ON);
    ?>
 />
	</td>
</tr>
<tr class="row-2">
	<td class="category">
		<?php 
    echo lang_get('advanced_update');
    ?>
	</td>
	<td>
		<input type="checkbox" name="advanced_update" <?php 
    check_checked($t_pref->advanced_update, ON);
    ?>
 />
	</td>
</tr>
<tr class="row-1">
	<td class="category">
		<?php 
    echo lang_get('refresh_delay');
    ?>
	</td>
	<td>
		<input type="text" name="refresh_delay" size="4" maxlength="4" value="<?php 
    echo $t_pref->refresh_delay;
    ?>
" />
	</td>
</tr>
<tr class="row-2">
	<td class="category">
		<?php 
    echo lang_get('redirect_delay');
    ?>
	</td>
	<td>
		<input type="text" name="redirect_delay" size="1" maxlength="1" value="<?php 
    echo $t_pref->redirect_delay;
    ?>
" />
	</td>
</tr>
<tr class="row-1">
	<td class="category">
		<?php 
    echo lang_get('bugnote_order');
    ?>
	</td>
	<td>
		<input type="radio" name="bugnote_order" value="ASC" <?php 
    check_checked($t_pref->bugnote_order, 'ASC');
    ?>
 /><?php 
    echo lang_get('bugnote_order_asc');
    ?>
		<input type="radio" name="bugnote_order" value="DESC" <?php 
    check_checked($t_pref->bugnote_order, 'DESC');
    ?>
 /><?php 
    echo lang_get('bugnote_order_desc');
    ?>
	</td>
</tr>
<?php 
    if (ON == config_get('enable_email_notification')) {
        ?>
<tr class="row-2">
	<td class="category">
		<?php 
        echo lang_get('email_on_new');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_new" <?php 
        check_checked($t_pref->email_on_new, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_new_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option value="<?php 
        echo OFF;
        ?>
"></option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_new_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr class="row-1">
	<td class="category">
		<?php 
        echo lang_get('email_on_assigned');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_assigned" <?php 
        check_checked($t_pref->email_on_assigned, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_assigned_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option value="<?php 
        echo OFF;
        ?>
"></option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_assigned_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr class="row-2">
	<td class="category">
		<?php 
        echo lang_get('email_on_feedback');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_feedback" <?php 
        check_checked($t_pref->email_on_feedback, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_feedback_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option value="<?php 
        echo OFF;
        ?>
"></option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_feedback_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr class="row-1">
	<td class="category">
		<?php 
        echo lang_get('email_on_resolved');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_resolved" <?php 
        check_checked($t_pref->email_on_resolved, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_resolved_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option value="<?php 
        echo OFF;
        ?>
"></option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_resolved_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr class="row-2">
	<td class="category">
		<?php 
        echo lang_get('email_on_closed');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_closed" <?php 
        check_checked($t_pref->email_on_closed, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_closed_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option value="<?php 
        echo OFF;
        ?>
"></option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_closed_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr class="row-1">
	<td class="category">
		<?php 
        echo lang_get('email_on_reopened');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_reopened" <?php 
        check_checked($t_pref->email_on_reopened, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_reopened_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option value="<?php 
        echo OFF;
        ?>
"></option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_reopened_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr class="row-2">
	<td class="category">
		<?php 
        echo lang_get('email_on_bugnote_added');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_bugnote" <?php 
        check_checked($t_pref->email_on_bugnote, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_bugnote_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option value="<?php 
        echo OFF;
        ?>
"></option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_bugnote_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr class="row-1">
	<td class="category">
		<?php 
        echo lang_get('email_on_status_change');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_status" <?php 
        check_checked($t_pref->email_on_status, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_status_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option value="<?php 
        echo OFF;
        ?>
"></option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_status_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr class="row-2">
	<td class="category">
		<?php 
        echo lang_get('email_on_priority_change');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_priority" <?php 
        check_checked($t_pref->email_on_priority, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_priority_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option value="<?php 
        echo OFF;
        ?>
"></option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_priority_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr class="row-1">
	<td class="category">
		<?php 
        echo lang_get('email_bugnote_limit');
        ?>
	</td>
	<td>
		<input type="text" name="email_bugnote_limit" maxlength="2" size="2" value="<?php 
        echo $t_pref->email_bugnote_limit;
        ?>
">
	</td>
</tr>
<?php 
    } else {
        ?>
		<input type="hidden" name="email_on_new"      value="<?php 
        echo $t_pref->email_on_new;
        ?>
" />
		<input type="hidden" name="email_on_assigned" value="<?php 
        echo $t_pref->email_on_assigned;
        ?>
" />
		<input type="hidden" name="email_on_feedback" value="<?php 
        echo $t_pref->email_on_feedback;
        ?>
" />
		<input type="hidden" name="email_on_resolved" value="<?php 
        echo $t_pref->email_on_resolved;
        ?>
" />
		<input type="hidden" name="email_on_closed"   value="<?php 
        echo $t_pref->email_on_closed;
        ?>
" />
		<input type="hidden" name="email_on_reopened" value="<?php 
        echo $t_pref->email_on_reopened;
        ?>
" />
		<input type="hidden" name="email_on_bugnote"  value="<?php 
        echo $t_pref->email_on_bugnote;
        ?>
" />
		<input type="hidden" name="email_on_status"   value="<?php 
        echo $t_pref->email_on_status;
        ?>
" />
		<input type="hidden" name="email_on_priority" value="<?php 
        echo $t_pref->email_on_priority;
        ?>
" />
		<input type="hidden" name="email_on_new_min_severity"      value="<?php 
        echo $t_pref->email_on_new_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_assigned_min_severity" value="<?php 
        echo $t_pref->email_on_assigned_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_feedback_min_severity" value="<?php 
        echo $t_pref->email_on_feedback_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_resolved_min_severity" value="<?php 
        echo $t_pref->email_on_resolved_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_closed_min_severity"   value="<?php 
        echo $t_pref->email_on_closed_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_reopened_min_severity" value="<?php 
        echo $t_pref->email_on_reopened_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_bugnote_min_severity"  value="<?php 
        echo $t_pref->email_on_bugnote_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_status_min_severity"   value="<?php 
        echo $t_pref->email_on_status_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_priority_min_severity" value="<?php 
        echo $t_pref->email_on_priority_min_severity;
        ?>
" />
		<input type="hidden" name="email_bugnote_limit" value="<?php 
        echo $t_pref->email_bugnote_limit;
        ?>
" />
<?php 
    }
    ?>
<tr class="row-2">
	<td class="category">
		<?php 
    echo lang_get('language');
    ?>
	</td>
	<td>
		<select name="language">
			<?php 
    print_language_option_list($t_pref->language);
    ?>
		</select>
	</td>
</tr>
<tr>
	<td colspan="2" class="center">
		<input type="submit" class="button" value="<?php 
    echo lang_get('update_prefs_button');
    ?>
" />
	</td>
</tr>
</table>
</form>
</div>

<br />

<div class="border-center">
	<form method="post" action="account_prefs_reset.php">
	<input type="hidden" name="user_id" value="<?php 
    echo $p_user_id;
    ?>
" />
	<input type="hidden" name="redirect_url" value="<?php 
    echo $t_redirect_url;
    ?>
" />
	<input type="submit" class="button" value="<?php 
    echo lang_get('reset_prefs_button');
    ?>
" />
	</form>
</div>

<?php 
}
示例#2
0
/**
 * Display html form to edit account preferences
 *
 * @param integer $p_user_id            A valid user identifier.
 * @param boolean $p_error_if_protected Whether to error if the account is protected.
 * @param boolean $p_accounts_menu      Display account preferences menu.
 * @param string  $p_redirect_url       Redirect URI.
 * @return void
 */
function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_accounts_menu = true, $p_redirect_url = '')
{
    if (null === $p_user_id) {
        $p_user_id = auth_get_current_user_id();
    }
    $t_redirect_url = $p_redirect_url;
    if (is_blank($t_redirect_url)) {
        $t_redirect_url = 'account_prefs_page.php';
    }
    # protected account check
    if (user_is_protected($p_user_id)) {
        if ($p_error_if_protected) {
            trigger_error(ERROR_PROTECTED_ACCOUNT, ERROR);
        } else {
            return;
        }
    }
    $t_pref = user_pref_get($p_user_id);
    # Account Preferences Form BEGIN
    ?>

<div id="account-prefs-update-div" class="form-container">
	<form id="account-prefs-update-form" method="post" action="account_prefs_update.php">
		<fieldset>
			<legend><span><?php 
    echo lang_get('default_account_preferences_title');
    ?>
</span></legend>
			<?php 
    echo form_security_field('account_prefs_update');
    ?>
			<input type="hidden" name="user_id" value="<?php 
    echo $p_user_id;
    ?>
" />
			<input type="hidden" name="redirect_url" value="<?php 
    echo $t_redirect_url;
    ?>
" />
		<?php 
    if ($p_accounts_menu) {
        print_account_menu('account_prefs_page.php');
    }
    ?>
			<div class="field-container">
				<label for="default-project-id"><span><?php 
    echo lang_get('default_project');
    ?>
</span></label>
				<span class="select">
					<select id="default-project-id" name="default_project">
<?php 
    # Count number of available projects
    $t_projects = current_user_get_accessible_projects();
    $t_num_proj = count($t_projects);
    if ($t_num_proj == 1) {
        $t_num_proj += count(current_user_get_accessible_subprojects($t_projects[0]));
    }
    # Don't display "All projects" in selection list if there is only 1
    print_project_option_list((int) $t_pref->default_project, $t_num_proj != 1);
    ?>
					</select>
				</span>
				<span class="label-style"></span>
			</div>
			<div class="field-container">
				<label for="refresh-delay"><span><?php 
    echo lang_get('refresh_delay');
    ?>
</span></label>
				<span class="input"><input id="refresh-delay" type="text" name="refresh_delay" size="4" maxlength="4" value="<?php 
    echo $t_pref->refresh_delay;
    ?>
" /> <?php 
    echo lang_get('minutes');
    ?>
</span>
				<span class="label-style"></span>
			</div>
			<div class="field-container">
				<label for="redirect-delay"><span><?php 
    echo lang_get('redirect_delay');
    ?>
</span></label>
				<span class="input"><input id="redirect-delay" type="text" name="redirect_delay" size="4" maxlength="3" value="<?php 
    echo $t_pref->redirect_delay;
    ?>
" /> <?php 
    echo lang_get('seconds');
    ?>
</span>
				<span class="label-style"></span>
			</div>
			<fieldset class="field-container">
				<legend><span><?php 
    echo lang_get('bugnote_order');
    ?>
</span></legend>
				<span class="radio"><input id="bugnote-order-desc" type="radio" name="bugnote_order" value="DESC" <?php 
    check_checked($t_pref->bugnote_order, 'DESC');
    ?>
 /></span>
				<label for="bugnote-order-desc"><span><?php 
    echo lang_get('bugnote_order_desc');
    ?>
</span></label>
				<span class="radio"><input id="bugnote-order-asc" type="radio" name="bugnote_order" value="ASC" <?php 
    check_checked($t_pref->bugnote_order, 'ASC');
    ?>
 /></span>
				<label for="bugnote-order-asc"><span><?php 
    echo lang_get('bugnote_order_asc');
    ?>
</span></label>
				<span class="label-style"></span>
			</fieldset>
			<?php 
    if (ON == config_get('enable_email_notification')) {
        ?>
			<fieldset class="field-container">
				<legend><label for="email-on-new"><?php 
        echo lang_get('email_on_new');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-new" type="checkbox" name="email_on_new" <?php 
        check_checked((int) $t_pref->email_on_new, ON);
        ?>
 /></span>
				<label for="email-on-new-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-new-min-severity" name="email_on_new_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_new_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-assigned"><?php 
        echo lang_get('email_on_assigned');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-assigned" type="checkbox" name="email_on_assigned" <?php 
        check_checked((int) $t_pref->email_on_assigned, ON);
        ?>
 /></span>
				<label for="email-on-assigned-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-assigned-min-severity" name="email_on_assigned_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_assigned_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-feedback"><?php 
        echo lang_get('email_on_feedback');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-feedback" type="checkbox" name="email_on_feedback" <?php 
        check_checked((int) $t_pref->email_on_feedback, ON);
        ?>
 /></span>
				<label for="email-on-feedback-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-feedback-min-severity" name="email_on_feedback_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_feedback_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-resolved"><?php 
        echo lang_get('email_on_resolved');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-resolved" type="checkbox" name="email_on_resolved" <?php 
        check_checked((int) $t_pref->email_on_resolved, ON);
        ?>
 /></span>
				<label for="email-on-resolved-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-resolved-min-severity" name="email_on_resolved_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_resolved_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-closed"><?php 
        echo lang_get('email_on_closed');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-closed" type="checkbox" name="email_on_closed" <?php 
        check_checked((int) $t_pref->email_on_closed, ON);
        ?>
 /></span>
				<label for="email-on-closed-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-closed-min-severity" name="email_on_closed_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_closed_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-reopened"><?php 
        echo lang_get('email_on_reopened');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-reopened" type="checkbox" name="email_on_reopened" <?php 
        check_checked((int) $t_pref->email_on_reopened, ON);
        ?>
 /></span>
				<label for="email-on-reopened-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-reopened-min-severity" name="email_on_reopened_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_reopened_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-bugnote-added"><?php 
        echo lang_get('email_on_bugnote_added');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-bugnote-added" type="checkbox" name="email_on_bugnote" <?php 
        check_checked((int) $t_pref->email_on_bugnote, ON);
        ?>
 /></span>
				<label for="email-on-bugnote-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-bugnote-min-severity" name="email_on_bugnote_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_bugnote_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-status"><?php 
        echo lang_get('email_on_status_change');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-status" type="checkbox" name="email_on_status" <?php 
        check_checked((int) $t_pref->email_on_status, ON);
        ?>
 /></span>
				<label for="email-on-status-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-status-min-severity" name="email_on_status_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_status_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<fieldset class="field-container">
				<legend><label for="email-on-priority-change"><?php 
        echo lang_get('email_on_priority_change');
        ?>
</label></legend>
				<span class="checkbox"><input id="email-on-priority-change" type="checkbox" name="email_on_priority" <?php 
        check_checked((int) $t_pref->email_on_priority, ON);
        ?>
 /></span>
				<label for="email-on-priority-min-severity" class="email-on-severity-label"><span><?php 
        echo lang_get('with_minimum_severity');
        ?>
</span></label>
				<span class="select email-on-severity">
					<select id="email-on-priority-min-severity" name="email_on_priority_min_severity">
						<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
						<option disabled="disabled">-----</option>
						<?php 
        print_enum_string_option_list('severity', (int) $t_pref->email_on_priority_min_severity);
        ?>
					</select>
				</span>
				<span class="label-style"></span>
			</fieldset>
			<div class="field-container">
				<label for="email-bugnote-limit"><span><?php 
        echo lang_get('email_bugnote_limit');
        ?>
</span></label>
				<span class="input"><input id="email-bugnote-limit" type="text" name="email_bugnote_limit" maxlength="2" size="2" value="<?php 
        echo $t_pref->email_bugnote_limit;
        ?>
" /></span>
				<span class="label-style"></span>
			</div>
<?php 
    } else {
        ?>
			<input type="hidden" name="email_on_new"      value="<?php 
        echo $t_pref->email_on_new;
        ?>
" />
			<input type="hidden" name="email_on_assigned" value="<?php 
        echo $t_pref->email_on_assigned;
        ?>
" />
			<input type="hidden" name="email_on_feedback" value="<?php 
        echo $t_pref->email_on_feedback;
        ?>
" />
			<input type="hidden" name="email_on_resolved" value="<?php 
        echo $t_pref->email_on_resolved;
        ?>
" />
			<input type="hidden" name="email_on_closed"   value="<?php 
        echo $t_pref->email_on_closed;
        ?>
" />
			<input type="hidden" name="email_on_reopened" value="<?php 
        echo $t_pref->email_on_reopened;
        ?>
" />
			<input type="hidden" name="email_on_bugnote"  value="<?php 
        echo $t_pref->email_on_bugnote;
        ?>
" />
			<input type="hidden" name="email_on_status"   value="<?php 
        echo $t_pref->email_on_status;
        ?>
" />
			<input type="hidden" name="email_on_priority" value="<?php 
        echo $t_pref->email_on_priority;
        ?>
" />
			<input type="hidden" name="email_on_new_min_severity"      value="<?php 
        echo $t_pref->email_on_new_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_assigned_min_severity" value="<?php 
        echo $t_pref->email_on_assigned_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_feedback_min_severity" value="<?php 
        echo $t_pref->email_on_feedback_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_resolved_min_severity" value="<?php 
        echo $t_pref->email_on_resolved_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_closed_min_severity"   value="<?php 
        echo $t_pref->email_on_closed_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_reopened_min_severity" value="<?php 
        echo $t_pref->email_on_reopened_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_bugnote_min_severity"  value="<?php 
        echo $t_pref->email_on_bugnote_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_status_min_severity"   value="<?php 
        echo $t_pref->email_on_status_min_severity;
        ?>
" />
			<input type="hidden" name="email_on_priority_min_severity" value="<?php 
        echo $t_pref->email_on_priority_min_severity;
        ?>
" />
			<input type="hidden" name="email_bugnote_limit" value="<?php 
        echo $t_pref->email_bugnote_limit;
        ?>
" />
<?php 
    }
    ?>
			<div class="field-container">
				<label for="timezone"><span><?php 
    echo lang_get('timezone');
    ?>
</span></label>
				<span class="select">
					<select id="timezone" name="timezone">
						<?php 
    print_timezone_option_list($t_pref->timezone ? $t_pref->timezone : config_get_global('default_timezone'));
    ?>
					</select>
				</span>
				<span class="label-style"></span>
			</div>
			<div class="field-container">
				<label for="language"><span><?php 
    echo lang_get('language');
    ?>
</span></label>
				<span class="select">
					<select id="language" name="language">
						<?php 
    print_language_option_list($t_pref->language);
    ?>
					</select>
				</span>
				<span class="label-style"></span>
			</div>

			<?php 
    event_signal('EVENT_ACCOUNT_PREF_UPDATE_FORM', array($p_user_id));
    ?>
			<span class="submit-button"><input type="submit" class="button" value="<?php 
    echo lang_get('update_prefs_button');
    ?>
" /></span>
		</fieldset>
	</form>
</div>

<div id="account-prefs-reset-div" class="form-container">
	<form id="account-prefs-reset-form" method="post" action="account_prefs_reset.php">
		<fieldset>
			<?php 
    echo form_security_field('account_prefs_reset');
    ?>
			<input type="hidden" name="user_id" value="<?php 
    echo $p_user_id;
    ?>
" />
			<input type="hidden" name="redirect_url" value="<?php 
    echo $t_redirect_url;
    ?>
" />
			<span class="submit-button"><input type="submit" class="button" value="<?php 
    echo lang_get('reset_prefs_button');
    ?>
" /></span>
		</fieldset>
	</form>
</div>

<?php 
}
示例#3
0
/**
 * Trigger an ERROR if the user account is protected
 *
 * @param integer $p_user_id A valid user identifier.
 * @return void
 */
function user_ensure_unprotected($p_user_id)
{
    if (user_is_protected($p_user_id)) {
        trigger_error(ERROR_PROTECTED_ACCOUNT, ERROR);
    }
}
示例#4
0
/**
 * Returns true if the current user is a protected user, false otherwise.
 * The $g_anonymous_account user is always considered protected.
 *
 * @return true: user is protected; false: otherwise.
 * @access public
 */
function current_user_is_protected()
{
    return user_is_protected(auth_get_current_user_id());
}
示例#5
0
$f_email = gpc_get_string('email');
$f_email = email_append_domain($f_email);
email_ensure_valid($f_email);
$t_user_table = db_get_table('user');
/** @todo Consider moving this query to user_api.php */
$query = 'SELECT id FROM ' . $t_user_table . ' WHERE username = '******' AND email = ' . db_param() . ' AND enabled=' . db_param();
$result = db_query_bound($query, array($f_username, $f_email, true));
if (0 == db_num_rows($result)) {
    trigger_error(ERROR_LOST_PASSWORD_NOT_MATCHING_DATA, ERROR);
}
if (is_blank($f_email)) {
    trigger_error(ERROR_LOST_PASSWORD_NO_EMAIL_SPECIFIED, ERROR);
}
$row = db_fetch_array($result);
$t_user_id = $row['id'];
if (user_is_protected($t_user_id)) {
    trigger_error(ERROR_PROTECTED_ACCOUNT, ERROR);
}
if (!user_is_lost_password_request_allowed($t_user_id)) {
    trigger_error(ERROR_LOST_PASSWORD_MAX_IN_PROGRESS_ATTEMPTS_REACHED, ERROR);
}
$t_confirm_hash = auth_generate_confirm_hash($t_user_id);
email_send_confirm_hash_url($t_user_id, $t_confirm_hash);
user_increment_lost_password_in_progress_count($t_user_id);
form_security_purge('lost_pwd');
$t_redirect_url = 'login_page.php';
html_page_top();
?>

<br />
<div>
function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_accounts_menu = true, $p_redirect_url = '')
{
    if (null === $p_user_id) {
        $p_user_id = auth_get_current_user_id();
    }
    $t_redirect_url = $p_redirect_url;
    if (is_blank($t_redirect_url)) {
        $t_redirect_url = 'account_prefs_page.php';
    }
    # protected account check
    if (user_is_protected($p_user_id)) {
        if ($p_error_if_protected) {
            trigger_error(ERROR_PROTECTED_ACCOUNT, ERROR);
        } else {
            return;
        }
    }
    # prefix data with u_
    $t_pref = user_pref_get($p_user_id);
    # Account Preferences Form BEGIN
    ?>
<br />
<div align="center">
<form method="post" action="account_prefs_update.php">
<?php 
    echo form_security_field('account_prefs_update');
    ?>
<input type="hidden" name="user_id" value="<?php 
    echo $p_user_id;
    ?>
" />
<input type="hidden" name="redirect_url" value="<?php 
    echo $t_redirect_url;
    ?>
" />
<table class="width75" cellspacing="1">
<tr>
	<td class="form-title">
		<?php 
    echo lang_get('default_account_preferences_title');
    ?>
	</td>
	<td class="right">
		<?php 
    if ($p_accounts_menu) {
        print_account_menu('account_prefs_page.php');
    }
    ?>
	</td>
</tr>
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<td class="category" width="50%">
		<?php 
    echo lang_get('default_project');
    ?>
	</td>
	<td width="50%">
		<select name="default_project">
<?php 
    # Count number of available projects
    $t_projects = current_user_get_accessible_projects();
    $t_num_proj = count($t_projects);
    if ($t_num_proj == 1) {
        $t_num_proj += count(current_user_get_accessible_subprojects($t_projects[0]));
    }
    # Don't display "All projects" in selection list if there is only 1
    print_project_option_list($t_pref->default_project, $t_num_proj != 1);
    ?>
		</select>
	</td>
</tr>
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<td class="category">
		<?php 
    echo lang_get('refresh_delay');
    ?>
	</td>
	<td>
		<input type="text" name="refresh_delay" size="4" maxlength="4" value="<?php 
    echo $t_pref->refresh_delay;
    ?>
" /> <?php 
    echo lang_get('minutes');
    ?>
	</td>
</tr>
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<td class="category">
		<?php 
    echo lang_get('redirect_delay');
    ?>
	</td>
	<td>
		<input type="text" name="redirect_delay" size="4" maxlength="3" value="<?php 
    echo $t_pref->redirect_delay;
    ?>
" /> <?php 
    echo lang_get('seconds');
    ?>
	</td>
</tr>
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<td class="category">
		<?php 
    echo lang_get('bugnote_order');
    ?>
	</td>
	<td>
		<label><input type="radio" name="bugnote_order" value="ASC" <?php 
    check_checked($t_pref->bugnote_order, 'ASC');
    ?>
 /><?php 
    echo lang_get('bugnote_order_asc');
    ?>
</label>
		<label><input type="radio" name="bugnote_order" value="DESC" <?php 
    check_checked($t_pref->bugnote_order, 'DESC');
    ?>
 /><?php 
    echo lang_get('bugnote_order_desc');
    ?>
</label>
	</td>
</tr>
<?php 
    if (ON == config_get('enable_email_notification')) {
        ?>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_new');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_new" <?php 
        check_checked($t_pref->email_on_new, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_new_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_new_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_assigned');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_assigned" <?php 
        check_checked($t_pref->email_on_assigned, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_assigned_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_assigned_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_feedback');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_feedback" <?php 
        check_checked($t_pref->email_on_feedback, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_feedback_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_feedback_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_resolved');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_resolved" <?php 
        check_checked($t_pref->email_on_resolved, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_resolved_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_resolved_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_closed');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_closed" <?php 
        check_checked($t_pref->email_on_closed, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_closed_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_closed_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_reopened');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_reopened" <?php 
        check_checked($t_pref->email_on_reopened, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_reopened_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_reopened_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_bugnote_added');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_bugnote" <?php 
        check_checked($t_pref->email_on_bugnote, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_bugnote_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_bugnote_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_status_change');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_status" <?php 
        check_checked($t_pref->email_on_status, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_status_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_status_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_on_priority_change');
        ?>
	</td>
	<td>
		<input type="checkbox" name="email_on_priority" <?php 
        check_checked($t_pref->email_on_priority, ON);
        ?>
 />
		<?php 
        echo lang_get('with_minimum_severity');
        ?>
		<select name="email_on_priority_min_severity">
			<option value="<?php 
        echo OFF;
        ?>
"><?php 
        echo lang_get('any');
        ?>
</option>
			<option disabled="disabled">-----</option>
			<?php 
        print_enum_string_option_list('severity', $t_pref->email_on_priority_min_severity);
        ?>
		</select>
	</td>
</tr>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
	<td class="category">
		<?php 
        echo lang_get('email_bugnote_limit');
        ?>
	</td>
	<td>
		<input type="text" name="email_bugnote_limit" maxlength="2" size="2" value="<?php 
        echo $t_pref->email_bugnote_limit;
        ?>
" />
	</td>
</tr>
<?php 
    } else {
        ?>
		<input type="hidden" name="email_on_new"      value="<?php 
        echo $t_pref->email_on_new;
        ?>
" />
		<input type="hidden" name="email_on_assigned" value="<?php 
        echo $t_pref->email_on_assigned;
        ?>
" />
		<input type="hidden" name="email_on_feedback" value="<?php 
        echo $t_pref->email_on_feedback;
        ?>
" />
		<input type="hidden" name="email_on_resolved" value="<?php 
        echo $t_pref->email_on_resolved;
        ?>
" />
		<input type="hidden" name="email_on_closed"   value="<?php 
        echo $t_pref->email_on_closed;
        ?>
" />
		<input type="hidden" name="email_on_reopened" value="<?php 
        echo $t_pref->email_on_reopened;
        ?>
" />
		<input type="hidden" name="email_on_bugnote"  value="<?php 
        echo $t_pref->email_on_bugnote;
        ?>
" />
		<input type="hidden" name="email_on_status"   value="<?php 
        echo $t_pref->email_on_status;
        ?>
" />
		<input type="hidden" name="email_on_priority" value="<?php 
        echo $t_pref->email_on_priority;
        ?>
" />
		<input type="hidden" name="email_on_new_min_severity"      value="<?php 
        echo $t_pref->email_on_new_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_assigned_min_severity" value="<?php 
        echo $t_pref->email_on_assigned_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_feedback_min_severity" value="<?php 
        echo $t_pref->email_on_feedback_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_resolved_min_severity" value="<?php 
        echo $t_pref->email_on_resolved_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_closed_min_severity"   value="<?php 
        echo $t_pref->email_on_closed_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_reopened_min_severity" value="<?php 
        echo $t_pref->email_on_reopened_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_bugnote_min_severity"  value="<?php 
        echo $t_pref->email_on_bugnote_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_status_min_severity"   value="<?php 
        echo $t_pref->email_on_status_min_severity;
        ?>
" />
		<input type="hidden" name="email_on_priority_min_severity" value="<?php 
        echo $t_pref->email_on_priority_min_severity;
        ?>
" />
		<input type="hidden" name="email_bugnote_limit" value="<?php 
        echo $t_pref->email_bugnote_limit;
        ?>
" />
<?php 
    }
    ?>
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<td class="category">
		<?php 
    echo lang_get('timezone');
    ?>
	</td>
	<td>
		<select name="timezone">
			<?php 
    print_timezone_option_list($t_pref->timezone ? $t_pref->timezone : config_get_global('default_timezone'));
    ?>
		</select>
	</td>
</tr>
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<td class="category">
		<?php 
    echo lang_get('language');
    ?>
	</td>
	<td>
		<select name="language">
			<?php 
    print_language_option_list($t_pref->language);
    ?>
		</select>
	</td>
</tr>
<?php 
    event_signal('EVENT_ACCOUNT_PREF_UPDATE_FORM', array($p_user_id));
    ?>
<tr>
	<td colspan="2" class="center">
		<input type="submit" class="button" value="<?php 
    echo lang_get('update_prefs_button');
    ?>
" />
	</td>
</tr>
</table>
</form>
</div>

<br />

<div class="border center">
	<form method="post" action="account_prefs_reset.php">
	<?php 
    echo form_security_field('account_prefs_reset');
    ?>
	<input type="hidden" name="user_id" value="<?php 
    echo $p_user_id;
    ?>
" />
	<input type="hidden" name="redirect_url" value="<?php 
    echo $t_redirect_url;
    ?>
" />
	<input type="submit" class="button" value="<?php 
    echo lang_get('reset_prefs_button');
    ?>
" />
	</form>
</div>

<?php 
}