コード例 #1
0
$relPath = "./../../pinc/";
include_once $relPath . 'base.inc';
include_once $relPath . 'metarefresh.inc';
include_once '../includes/team.inc';
require_login();
$tid = get_integer_param($_GET, 'tid', null, 0, null);
if ($userP['team_1'] == $tid || $userP['team_2'] == $tid || $userP['team_3'] == $tid) {
    $quitQuery = "UPDATE users SET ";
    if ($userP['team_1'] == $tid) {
        $quitQuery .= "team_1 = '0'";
    }
    if ($userP['team_2'] == $tid) {
        $quitQuery .= "team_2 = '0'";
    }
    if ($userP['team_3'] == $tid) {
        $quitQuery .= "team_3 = '0'";
    }
    $quitQuery .= " WHERE username='******' AND u_id='" . $userP['u_id'] . "'";
    $teamResult = mysql_query($quitQuery);
    mysql_query("UPDATE user_teams SET active_members = active_members-1 WHERE id='" . $tid . "'");
    dpsession_set_preferences_from_db();
    $title = _("Quit the Team");
    $desc = _("Quitting the team....");
    metarefresh(0, "../teams/tdetail.php?tid=" . $tid . "", $title, $desc);
} else {
    $title = _("Not a member");
    $desc = _("Unable to quit team....");
    metarefresh(3, "../teams/tdetail.php?tid=" . $tid . "", $title, $desc);
}
// vim: sw=4 ts=4 expandtab
コード例 #2
0
function save_pm_tab()
{
    global $uid, $pguser;
    global $userSettings;
    // set users values
    $input_string_fields = array();
    //  i_pmdefault is "Default PM Page"
    $input_numeric_fields = array("i_pmdefault");
    $update_string = _create_mysql_update_string($_POST, $input_string_fields, $input_numeric_fields);
    $users_query = sprintf("\n        UPDATE users\n        SET {$update_string}\n        WHERE u_id={$uid} AND username='******'", mysql_real_escape_string($pguser));
    mysql_query($users_query);
    echo mysql_error();
    // remember if the PM wants to be automatically signed up for email notifications of
    // replies made to their project threads
    $userSettings->set_boolean('auto_proj_thread', $_POST["auto_proj_thread"] == 'yes');
    // remember if the PM wants to have their projects automatically assigned
    // to them for PP
    $userSettings->set_boolean('send_to_post', $_POST["send_to_post"] == 'yes');
    dpsession_set_preferences_from_db();
}