2 /* get some information from the database */
3 error_reporting(E_ALL);
5 /* start a session, if it is not already running.
6 * This way people don't have to log in all the times.
7 * The session variables can also be read out from different
8 * php scripts, so that the code can be easily split up across several files
11 include_once("config.php"); /* needs to be first in list, since other includes use this */
12 include_once("./include/output.php"); /* html output only */
13 include_once("./include/db.php"); /* database only */
14 include_once("./include/functions.php"); /* the rest */
16 /* make sure that user has set all variables in config.php */
19 /* open the database */
23 echo "Database error, can't connect... Please wait a while and try again. ".
24 "If the problem doesn't go away feel free to contact $ADMIN_NAME at $ADMIN_EMAIL.";
32 if(!myisset("uid","token"))
38 $id = $_REQUEST['uid'];
39 $token = get_user_token($id);
41 if($token == $_REQUEST['token'])
47 echo "No valid userid";
51 header("Content-Type: text/xml");
54 <feed xmlns="http://www.w3.org/2005/Atom">
55 <title>E-DoKo Feed</title>
56 <subtitle>Know when it is your turn</subtitle>
59 global $WIKI,$INDEX, $HOST;
61 /* output last creation date */
62 echo "<link href=\"$HOST/$INDEX\" />\n";
63 echo "<link rel=\"self\" href=\"".$HOST.htmlentities($_SERVER['REQUEST_URI'])."\" />\n";
64 $date = DB_query_array("Select create_date from User order by create_date ASC limit 1");
66 $timestamp = strtotime($date);
67 echo "<id>tag:".$_SERVER['SERVER_NAME'].",".date("Y-m-d",$timestamp).":$INDEX</id>\n";
68 echo "<updated>".date(DATE_ATOM)."</updated>\n";
70 echo "<name>$ADMIN_NAME $date $timestamp</name>\n";
71 echo "<email>$ADMIN_EMAIL</email>\n";
75 /* output the entries */
78 $result = DB_query("SELECT Hand.hash,Hand.game_id,Game.player from Hand".
79 " LEFT JOIN Game On Hand.game_id=Game.id".
80 " WHERE Hand.user_id='$id'".
81 " AND ( Game.player='$id' OR ISNULL(Game.player) )".
82 " AND ( Game.status='pre' OR Game.status='play' )".
83 " ORDER BY Game.session" );
85 while( $r = DB_fetch_array($result))
88 echo "<title>game ".DB_format_gameid($r[1])."</title>\n";
89 $url=$INDEX."?action=game&me=".$r[0];
90 echo "<link href=\"".$HOST.$url."\" />\n";
91 $date = DB_get_game_timestamp($r[1]);
92 $timestamp = strtotime($date);
93 $date = date("Y-m-d",$timestamp);
94 echo "<id>tag:doko.nubati.net,$date:$url</id>\n";
95 echo "<updated>".date(DATE_ATOM,$timestamp)."</updated>\n";
96 echo "<summary>Please use the link to access the game.</summary>\n";