Exemplo n.º 1
0
        $mails = implode(",", $mails_a);
        // Note: teams are not deleted but disabled depending on their status
        $id = $DB->q('MAYBEVALUE SELECT teamid FROM team
			      WHERE externalid=%i', $team['teamId']);
        $enabled = $team['status'] === 'ACCEPTED';
        if (empty($id)) {
            $id = $DB->q('RETURNID INSERT INTO team
				      (name, categoryid, affilid, enabled, members, comments, externalid, room)
				      VALUES (%s, %i, %i, %i, %s, %s, %i, %s)', $team['teamName'], $participants, $affilid, $enabled, $members, "Status: " . $team['status'], $team['teamId'], $siteName);
            $username = sprintf("team%04d", $id);
            $userid = $DB->q('RETURNID INSERT INTO user (username, name, teamid, email)
					  VALUES (%s,%s,%i,%s)', $username, $team['teamName'], $id, $mails);
            $DB->q('INSERT INTO userrole (userid, roleid) VALUES (%i,%i)', $userid, $teamrole);
            $new_teams[] = $team['teamName'];
        } else {
            $username = sprintf("team%04d", $id);
            $cnt = $DB->q('RETURNAFFECTED UPDATE team SET name=%s, categoryid=%i,
				       affilid=%i, enabled=%i, members=%s, comments=%s, room=%s
				       WHERE teamid=%i', $team['teamName'], $participants, $affilid, $enabled, $members, "Status: " . $team['status'], $siteName, $id);
            $cnt += $DB->q('RETURNAFFECTED UPDATE user SET name=%s, email=%s
					WHERE username=%s', $team['teamName'], $mails, $username);
            if ($cnt > 0) {
                $updated_teams[] = $team['teamName'];
            }
        }
    }
}
updated($new_affils, "team affiliation");
updated($new_teams, "team");
updated($updated_teams, "team", "updated");
Exemplo n.º 2
0
         $cookie = isset($_POST['cookie']) ? 1 : 0;
         include FOLDER_PATH . 'inc/password.inc.php';
         if ($admin_username != encrypt($username)) {
             $error_string[] = $msg_login6;
         }
         if ($admin_password != encrypt($password)) {
             $error_string[] = $msg_login7;
         }
         if ($error_string) {
             error($msg_script5, $error_string, $msg_script7, $msg_charset);
         } else {
             $_SESSION['weblog_user'] = $username;
             if ($cookie) {
                 setcookie($database['cookieName'], encrypt($database['cookieKey']), time() + 60 * 60 * 24 * 30);
             }
             updated($msg_login8, 'index.php', $msg_script4, $msg_script6, $msg_charset);
         }
     }
     include FOLDER_PATH . 'inc/header.php';
     include FOLDER_PATH . 'data_files/login.php';
     include FOLDER_PATH . 'inc/footer.php';
     break;
     //--------------------
     // CASE: Logout
     //--------------------
 //--------------------
 // CASE: Logout
 //--------------------
 case "logout":
     session_unset();
     session_destroy();