function writeHistory() { global $numMoves; /* old PHP versions don't have _POST, _GET and _SESSION as auto_globals */ if (!minimum_version("4.1.0")) { global $_POST, $_GET, $_SESSION; } /* based on player's preferences, display the history */ $moves = array(); // Make sure that $moves is defined switch ($_SESSION['pref_history']) { case 'verbous': $moves = writeVerbousHistory(); break; case 'pgn': $moves = writeHistoryPGN(); break; } $comma = ''; echo "var moves = ["; for ($i = 0; $i < count($moves); $i++) { echo $comma; if ($i % 4 == 0) { // Four moves on each line echo "\n"; } echo "['" . $moves[$i][0] . "', '" . $moves[$i][1] . "']"; $comma = ', '; } echo "];\n"; }
function writeHistory() { global $MSG_LANG,$db,$db_prefix; /* based on player's preferences, display the history */ switch($_SESSION['pref_history']) { case 'verbose': writeVerbousHistory(); break; case 'pgn': writeHistoryPGN(); break; case 'graphic': echo ("<table border='0' width=300 bgcolor=black cellspacing=1 cellpading=1>\n"); echo ("<tr><th bgcolor='beige'>".strtoupper($MSG_LANG["history"])."</th></tr>\n"); echo ("<tr><td bgcolor=white>"); writeHistoryPGN("plain", 'chess'); echo ("</td></tr></table>"); break; } }