function processMbox($file)
{
    set_time_limit(6000);
    if (!TEST) {
        $link = imap_open($file, "", "", CL_EXPUNGE);
    } else {
        $link = imap_open($file, "", "");
    }
    if (!$link) {
        outputProcessBounce($GLOBALS['I18N']->get("Cannot open mailbox file") . " " . imap_last_error());
        return;
    }
    return processMessages($link, 100000);
}
function processMbox ($file) {
  set_time_limit(6000);

  if (!TEST) {
	  $link=imap_open($file,"","",CL_EXPUNGE);
  } else {
	  $link=imap_open($file,"","");
  }
  if (!$link) {
  	Error("Cannot open mailbox file ".imap_last_error());
    return;
  }
	return processMessages($link,100000);
}
Exemple #3
0
loadGame();
// sets up board using last entry in ".T_HISTORY." table (chessdb.inc.php)
FENtomoves();
// creates movesArray from FENarray (chessutils.inc.php)
// find out if it's the current player's turn
$FENitems = explode(' ', $FENarray[$num_moves]);
$curTurn = $colorArray[$FENitems[1]];
// convert w -> white, b -> black
$isPlayersTurn = $curTurn == $_SESSION['player']['p_color'] ? true : false;
//*/
//******************************************************************************
//  save incoming information
//******************************************************************************
checkDatabase();
// check the database data against the current FEN to make sure the game is ended properly (chessdb.inc.php)
processMessages();
// processes the messages (undo, resign, etc) (chessdb.inc.php)
// are we undoing ?
if ($undoing && 0 < $num_moves) {
    call("UNDO REQUEST");
    // just remove the last FEN entered into the history table
    $query = "\n\t\tSELECT MAX(h_time)\n\t\tFROM " . T_HISTORY . "\n\t\tWHERE h_game_id = '{$_SESSION['game_id']}'\n\t";
    $max_time = $mysql->fetch_value($query, __LINE__, __FILE__);
    $query = "\n\t\tDELETE FROM " . T_HISTORY . "\n\t\tWHERE h_game_id = '{$_SESSION['game_id']}'\n\t\t\tAND h_time = '{$max_time}'\n\t\tLIMIT 1\n\t";
    $mysql->query($query, __LINE__, __FILE__);
    if (!DEBUG) {
        header("Location: ./chess.php");
    }
} elseif (isset($_POST['promotion']) && '' != $_POST['promotion'] && false != $_POST['promoting']) {
    call("SAVING PROMOTION");
    savePromotion();
    //exit;
}
$white = $row['white_player'];
$black = $row['black_player'];
$timeLimit = $row['time_limit'];
$flag_fall = $row['flag_fall'];
$rated = $row['rated'];
$team_match = $row['team_match'];
//are we even using this right now or in the future?
if ($row['white_player'] == $_SESSION['player_id']) {
    //let's show a realtime calculation "if you win "right now" you get x points, and show player's realtime rating
    //calculate points here plus show ratings
} else {
    //TODO: see above note
}
$game_messages = processMessages();
//Verify permission
//WHERE the hell does numMoves come from? throughout here it appears to use math
//to determine who's turn it is. how does the board update (pieces) without updating history and moves, etc?
//yeesh!
//solution- CONSISTENT use of whose_turn in game info- the hell with using history to determine whose turn?!
//White *ALWAYS* moves first so, number of moves will be odd when its black's turn
//Let's start using just the "whose turn" value instead of this silly calculation...
if ($numMoves == -1 || $numMoves % 2 == 1) {
    $mycolor2 = "white";
} else {
    $mycolor2 = "black";
}
// find out if it's the current player's turn    - See above- let's make it simple- use whose_turn
if (($numMoves == -1 || $numMoves % 2 == 1) && $playersColor == "white" || $numMoves % 2 == 0 && $playersColor == "black") {
    $isPlayersTurn = true;